Merge branch 'dev'
Change-Id: I7f214612d63dd506ac2a6a5af7a842d8b7aa4de4
diff --git a/NOTICE.txt b/NOTICE.txt
index 0dc71e0..5de48b2 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -75,7 +75,7 @@
Google Guava Version: 25.0-jre (25.0)
* License: Apache License, 2.0
-
+
Gradle Wrapper (4.10.2)
* License: Apache License, 2.0
@@ -142,12 +142,18 @@
jersey-server-2.23.2.jar (2.23.2)
* License: Apache-2.0
+log4j-over-slf4j-1.7.25.jar (1.7.25)
+ * License: Apache-2.0
+
logback-classic-1.2.3.jar(1.2.3)
* License: Eclipse Public License 1.0
logback-core-1.2.3.jar(1.2.3)
* License: Eclipse Public License 1.0
+openatfx-0.7.4.jar (0.7.4)
+ * License: Apache-2.0
+
osgi-resource-locator-1.0.1.jar(1.0.1)
* License: CDDL
@@ -164,70 +170,86 @@
* Source URL: https://github.com/qos-ch/slf4j/releases/tag/v_1.7.25
validation-api-1.1.0.Final.jar (1.1.0.Final)
-* License: Apache License, 2.0
+ * License: Apache License, 2.0
vavr-0.9.1-sources.jar (0.9.1)
-* License: Apache License, 2.0
+ * License: Apache License, 2.0
-@angular/common@2.4.8
+woodstox-core-asl-4.4.1.jar (4.4.1)
+ * License: Apache License, 2.0
+
+
+FFAMFAMFAM Silk Icon, Version 1.3
+ * License: Creative Commons Attribution 3.0 License
+ * Licence Path: https://creativecommons.org/licenses/by/3.0/
+ * Project: http://www.famfamfam.com/lab/icons/silk/
+ * Source: http://www.famfamfam.com/lab/icons/silk/
+
+@angular/animations:7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io/api/animations
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@angular/compiler@2.4.8
+@angular/cdk:7.1.1
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io/api
+ * Source: https://github.com/angular/angular/releases/tag/7.1.1
-@angular/core@2.4.8
+
+@angular/common@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io/api/common
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4r
-@angular/forms@2.4.8
+@angular/compiler@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@angular/http@2.4.8
+@angular/core@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@angular/platform-browser-dynamic@2.4.8
+@angular/forms@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@angular/platform-browser@2.4.8
+@angular/http@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@angular/router@3.4.8
+@angular/platform-browser-dynamic@7.2.4
* License: MIT
* Licence Path: https://github.com/angular/angular/blob/master/LICENSE
- * Project: https://github.com/angular/angular
- * Source: https://github.com/angular/angular
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-@types/file-saver@0.0.0
+@angular/platform-browser@7.2.4
* License: MIT
- * Licence Path: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE
- * Project: https://github.com/DefinitelyTyped/DefinitelyTyped
- * Source: https://github.com/DefinitelyTyped/DefinitelyTyped
+ * Licence Path: https://github.com/angular/angular/blob/master/LICENSE
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
-bootstrap@3.3.7
+@angular/router@7.2.4
+ * License: MIT
+ * Licence Path: https://github.com/angular/angular/blob/master/LICENSE
+ * Project: https://angular.io
+ * Source: https://github.com/angular/angular/releases/tag/7.2.4
+
+bootstrap@4.1.3
* License: MIT
* Licence Path: https://github.com/twbs/bootstrap/raw/master/LICENSE
- * Project: https://github.com/twbs/bootstrap
+ * Project: https://getbootstrap.com/
* Source: https://github.com/twbs/bootstrap
class-transformer@0.1.6
@@ -236,11 +258,11 @@
* Project: https://github.com/pleerock/class-transformer
* Source: https://github.com/pleerock/class-transformer
-core-js@2.4.1
+core-js@2.6.0
* License: MIT
* Licence Path: https://github.com/zloirock/core-js/raw/master/LICENSE
* Project: https://github.com/zloirock/core-js
- * Source: https://github.com/zloirock/core-js
+ * Source: https://github.com/zloirock/core-js/releases/tag/v2.6.0
file-saver@1.3.3
* License: MIT
@@ -254,63 +276,58 @@
* Project: https://fontawesome.com/
* Source: https://github.com/FortAwesome/Font-Awesome
-moment@2.17.1
- * License: MIT
- * Licence Path: https://github.com/moment/moment/raw/master/LICENSE
- * Project: https://github.com/moment/moment
- * Source: https://github.com/moment/moment
-
-ngx-bootstrap@1.9.1
- * License: MIT
- * Licence Path: https://github.com/valor-software/ngx-bootstrap/blob/development/LICENSE
- * Project: https://valor-software.com/ngx-bootstrap
- * Source: https://github.com/valor-software/ngx-bootstrap
-
ng2-split-pane@1.3.1
* License: MIT
* Licence Path: https://github.com/wannabegeek/ng2-split-pane/raw/master/LICENSE
* Project: https://github.com/wannabegeek/ng2-split-pane
* Source: https://github.com/wannabegeek/ng2-split-pane
-primeng@2.0.5
+ngx-bootstrap@3.1.2
* License: MIT
- * Licence Path: https://github.com/primefaces/primeng/raw/master/LICENSE.md
- * Project: https://github.com/primefaces/primeng
- * Source: https://github.com/primefaces/primeng
+ * Licence Path: https://github.com/valor-software/ngx-bootstrap/blob/v3.1.2/LICENSE
+ * Project: https://valor-software.com/ngx-bootstrap
+ * Source: https://github.com/valor-software/ngx-bootstrap/tree/v3.1.2
-reflect-metadata@0.1.3
- * License: Apache-2.0
- * Project: https://github.com/rbuckton/ReflectDecorators
- * Source: https://github.com/rbuckton/ReflectDecorators
+primeicons:1.0.0
+ * License: MIT
+ * Licence Path: https://github.com/primefaces/primeicons/blob/1.0.0/LICENSE
+ * Project: https://www.primefaces.org/primeng
+ * Source: https://github.com/primefaces/primeicons/tree/1.0.0
+
+primeng@7.0.1
+ * License: MIT
+ * Licence Path: https://github.com/primefaces/primeng/blob/7.0.1/LICENSE.md
+ * Project: https://www.primefaces.org/primeng
+ * Source: https://github.com/primefaces/primeng/tree/7.0.1
rxjs@5.1.0
* License: Apache-2.0
- * Project: https://github.com/ReactiveX/RxJS
- * Source: https://github.com/ReactiveX/RxJS
+ * Project: https://rxjs-dev.firebaseapp.com/
+ * Source: https://github.com/ReactiveX/rxjs/tree/6.3.3
-symbol-observable@1.2.0
- * License: MIT
- * Licence Path: https://github.com/blesh/symbol-observable/raw/master/license
- * Project: https://github.com/blesh/symbol-observable
- * Source: https://github.com/blesh/symbol-observable
+rxjs-compat:6.3.3
+ * License: Apache-2.0
+ * Project: https://rxjs-dev.firebaseapp.com/
+ * Source: https://github.com/ReactiveX/rxjs/tree/6.3.3/compat
-ts-helpers@1.1.1
- * License: MIT
- * Licence Path: https://github.com/ngParty/ts-helpers/raw/master/LICENSE
- * Project: https://github.com/ngParty/ts-helpers
- * Source: https://github.com/ngParty/ts-helpers
-zone.js@0.7.6
+zone.js@0.8.26
* License: MIT
* Licence Path: https://github.com/angular/zone.js/raw/master/LICENSE
* Project: https://github.com/angular
- * Source: https://github.com/angular/zone.js
-
-FFAMFAMFAM Silk Icon, Version 1.3
- * License: Creative Commons Attribution 3.0 License
- * Licence Path: https://creativecommons.org/licenses/by/3.0/
- * Project: http://www.famfamfam.com/lab/icons/silk/
- * Source: http://www.famfamfam.com/lab/icons/silk/
+ * Source: https://github.com/angular/zone.js/releases/tag/v0.8.26
+
+OMG Event Service Specification (1.2)
+
+* License: LicenseRef - Object-Management-Group-License
+* Project: https://www.omg.org/spec/EVNT/1.2/
+* Source: https://www.omg.org/spec/EVNT/1.2/pdf
+
+OMG Notification Service Specification (1.1)
+
+* License: LicenseRef - Object-Management-Group-License
+* Project: https://www.omg.org/spec/NOT/
+* Source: https://www.omg.org/spec/NOT/1.1/PDF
ods530.idl
Permission of use:
@@ -326,19 +343,10 @@
From Dr. Ralph Noerenberg
Date: 08/15/2016
"Herewith, we release the generated Client-Source-Code generated from our CORBA IDLs, namely
-* CORBANotification Service (generated from AvalonEvent.idl)
-* CORBAFileServer (generated from CorbaFileServer.idl),
-Under the Eclipse Public License (EPL). This agreement does not include the AvalonEvent.idl and
-CorbaFileServer.idl itself, which remain protected property of HighQSoft. "
-
-OMG Notification Service Specification Version: 1.1
-The terms of use are defined in section "Freely Available And Available
-Free" see: http://www.omg.org/gettingstarted/overview.htm
-
-OMG Event Service Specification Version: 1.2
-The terms of use are defined in section "Freely Available And Available
-Free" see: http://www.omg.org/gettingstarted/overview.htm
-
+* CORBANotification Service (generated from „AvalonEvent.idl”)
+* CORBAFileServer (generated from „CorbaFileServer.idl“),
+Under the Eclipse Public License (EPL). This agreement does not include the „AvalonEvent.idl“ and
+„CorbaFileServer.idl“ itself, which remain protected property of HighQSoft. "
## Cryptography
diff --git a/build.gradle b/build.gradle
index fa4c8e5..070437a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,48 +1,48 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-description = 'MDM API - Base Model'
-group = 'org.eclipse.mdm'
-version = '5.1.0M2'
-
-apply plugin: 'java'
-apply plugin: 'maven'
-apply plugin: 'eclipse'
-
-repositories {
- mavenLocal()
- mavenCentral()
-}
-
-dependencies {
- // testing
- testCompile 'junit:junit:4.12'
- testCompile 'org.mockito:mockito-core:2.13.0'
- testCompile 'org.assertj:assertj-core:3.6.2'
-}
-
-jar {
- metaInf { from 'NOTICE.txt' }
- metaInf { from 'LICENSE.txt' }
-}
-
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
-}
-
-artifacts {
- archives sourcesJar
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+
+description = 'MDM API - Base Model'
+group = 'org.eclipse.mdm'
+version = '5.1.0M3-SNAPSHOT'
+
+apply plugin: 'java'
+apply plugin: 'maven'
+apply plugin: 'eclipse'
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+dependencies {
+ // testing
+ testCompile 'junit:junit:4.12'
+ testCompile 'org.mockito:mockito-core:2.13.0'
+ testCompile 'org.assertj:assertj-core:3.6.2'
+}
+
+jar {
+ metaInf { from 'NOTICE.txt' }
+ metaInf { from 'LICENSE.txt' }
+}
+
+task sourcesJar(type: Jar, dependsOn: classes) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+}
+
+artifacts {
+ archives sourcesJar
}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContext.java b/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContext.java
index 3d961fd..964eb0c 100644
--- a/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContext.java
+++ b/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContext.java
@@ -1,16 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base;
@@ -20,22 +20,20 @@
import org.eclipse.mdm.api.base.adapter.ModelManager;
import org.eclipse.mdm.api.base.file.FileService;
import org.eclipse.mdm.api.base.model.BaseEntityFactory;
-import org.eclipse.mdm.api.base.model.Entity;
import org.eclipse.mdm.api.base.notification.NotificationService;
import org.eclipse.mdm.api.base.query.QueryService;
import org.eclipse.mdm.api.base.search.SearchService;
/**
- * Base application context represents a connection/session to the underlying data store.
- * It provides access to managers and services.
+ * Base application context represents a connection/session to the underlying
+ * data store. It provides access to managers and services.
*
- * @param <S>
- * Type of the connected entity factory.
- * @param <T>
- * Type of the connected entity manager.
+ * @param <S> Type of the connected entity factory.
+ * @param <T> Type of the connected entity manager.
* @since 1.0.0
*/
-public interface BaseApplicationContext<S extends BaseEntityFactory, T extends BaseEntityManager> extends AutoCloseable {
+public interface BaseApplicationContext<S extends BaseEntityFactory, T extends BaseEntityManager>
+ extends AutoCloseable {
/**
* The returned service loads entities from the underlying data source.
*
@@ -44,7 +42,7 @@
default Optional<T> getEntityManager() {
return Optional.empty();
}
-
+
/**
* The returned service creates new entities.
*
@@ -84,10 +82,9 @@
default Optional<QueryService> getQueryService() {
return Optional.empty();
}
-
+
/**
- * The returned service allows to download linked files from the file
- * storage.
+ * The returned service allows to download linked files from the file storage.
*
* @return {@code Optional} is empty if no such service is available.
* @see FileService
@@ -95,9 +92,10 @@
default Optional<FileService> getFileService() {
return Optional.empty();
}
-
+
/**
- * The returned service allows to register/unregister for events at a registration service.
+ * The returned service allows to register/unregister for events at a
+ * registration service.
*
* @return {@code Optional} is empty if no such service is available.
* @see NotificationService
@@ -105,23 +103,24 @@
default Optional<NotificationService> getNotificationService() {
return Optional.empty();
}
-
+
/**
- * Returns a map with all configuration parameters, which where given to initialize this context.
+ * Returns a map with all configuration parameters, which where given to
+ * initialize this context.
*
* @return map with configuration parameters
*/
Map<String, String> getParameters();
-
+
/**
* Returns a string describing the type of the underlying API implementation.
- * The exact content is up to the individual adapter and it is intended to be
+ * The exact content is up to the individual adapter and it is intended to be
* interpreted by the client.
*
* @return a string describing the type of the underlying API implementation.
*/
String getAdapterType();
-
+
/**
* Closes the BaseContext.
*
diff --git a/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContextFactory.java b/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContextFactory.java
index e1ad5b6..0de5fef 100644
--- a/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContextFactory.java
+++ b/src/main/java/org/eclipse/mdm/api/base/BaseApplicationContextFactory.java
@@ -1,16 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base;
@@ -19,23 +19,21 @@
import org.eclipse.mdm.api.base.model.BaseEntityFactory;
/**
- * Takes connection parameters and produces a corresponding base application context.
+ * Takes connection parameters and produces a corresponding base application
+ * context.
*
- * @param <T>
- * Type of the connected entity manager.
+ * @param <T> Type of the connected entity manager.
* @since 1.0.0
*/
public interface BaseApplicationContextFactory<T extends BaseApplicationContext<? extends BaseEntityFactory, ? extends BaseEntityManager>> {
/**
- * Takes given connection parameters and creates a new context, which
- * is permanently connected with configured data source.
+ * Takes given connection parameters and creates a new context, which is
+ * permanently connected with configured data source.
*
- * @param connectionParameters
- * The connection parameters.
+ * @param connectionParameters The connection parameters.
* @return The connected context is returned.
- * @throws ConnectionException
- * Thrown if unable to connect to a data source.
+ * @throws ConnectionException Thrown if unable to connect to a data source.
*/
T connect(Map<String, String> connectionParameters) throws ConnectionException;
}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java b/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
index 98a7ec5..745bda9 100644
--- a/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
+++ b/src/main/java/org/eclipse/mdm/api/base/BaseEntityManager.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base;
import java.util.Collection;
@@ -47,9 +46,8 @@
* Returns the {@link Environment} this entity manager is connected to.
*
* @return The {@code Environment} is returned.
- * @throws DataAccessException
- * Thrown if unable to retrieve the {@code
- * Environment}.
+ * @throws DataAccessException Thrown if unable to retrieve the {@code
+ * Environment} .
*/
Environment loadEnvironment() throws DataAccessException;
@@ -59,8 +57,7 @@
*
* @return {@code Optional} is empty if the data source connection is user
* independent, which is implementation specific.
- * @throws DataAccessException
- * Thrown if unable to retrieve the {@code User}.
+ * @throws DataAccessException Thrown if unable to retrieve the {@code User}.
*/
default Optional<User> loadLoggedOnUser() throws DataAccessException {
return Optional.empty();
@@ -69,15 +66,11 @@
/**
* Loads the entity identified by given entity class and its instance ID.
*
- * @param <T>
- * The desired type.
- * @param entityClass
- * Type of the returned entity.
- * @param instanceID
- * The instance ID.
+ * @param <T> The desired type.
+ * @param entityClass Type of the returned entity.
+ * @param instanceID The instance ID.
* @return The entity with given instance ID is returned.
- * @throws DataAccessException
- * Thrown if unable to retrieve the entity.
+ * @throws DataAccessException Thrown if unable to retrieve the entity.
*/
default <T extends Entity> T load(Class<T> entityClass, String instanceID) throws DataAccessException {
List<T> entities = load(entityClass, Collections.singletonList(instanceID));
@@ -90,14 +83,15 @@
/**
* Loads the entities identified by given entity class and its instance IDs.
*
- * @param <T> The desired type.
+ * @param <T> The desired type.
* @param entityClass Type of the returned entities.
- * @param instanceIDs The instance IDs to load. If a instance ID does not exist, it is ignored.
+ * @param instanceIDs The instance IDs to load. If a instance ID does not exist,
+ * it is ignored.
* @return Entities are returned in a list.
* @throws DataAccessException Thrown if unable to retrieve the entities.
*/
<T extends Entity> List<T> load(Class<T> entityClass, Collection<String> instanceIDs) throws DataAccessException;
-
+
/**
* Loads all available entities of given type. This method is useful while
* working with types whose amount is known to be fairly small (e.g.:
@@ -114,13 +108,10 @@
* }
* </pre>
*
- * @param <T>
- * The desired type.
- * @param entityClass
- * Type of the returned entities.
+ * @param <T> The desired type.
+ * @param entityClass Type of the returned entities.
* @return Entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the entities.
+ * @throws DataAccessException Thrown if unable to retrieve the entities.
* @see #loadAll(Class, String)
*/
default <T extends Entity> List<T> loadAll(Class<T> entityClass) throws DataAccessException {
@@ -129,12 +120,12 @@
/**
* Loads all available entities of given type whose name fulfills the given
- * pattern. This method is useful while working with types whose amount is
- * known to be fairly small (e.g.: {@code Unit}, {@code Quantity}, etc.). If
- * a type is given where thousand instances exist (e.g.: {@code Test}) the
- * behavior of this method is implementation specific. The following
- * invocation might take its time to complete or even result in an exception
- * as soon as too many results are found:
+ * pattern. This method is useful while working with types whose amount is known
+ * to be fairly small (e.g.: {@code Unit}, {@code Quantity}, etc.). If a type is
+ * given where thousand instances exist (e.g.: {@code Test}) the behavior of
+ * this method is implementation specific. The following invocation might take
+ * its time to complete or even result in an exception as soon as too many
+ * results are found:
*
* <pre>
* {
@@ -144,24 +135,20 @@
* }
* </pre>
*
- * @param <T>
- * The desired type.
- * @param entityClass
- * Type of the returned entities.
- * @param pattern
- * Is always case sensitive and may contain wildcard characters
- * as follows: "?" for one matching character and "*" for a
- * sequence of matching characters.
+ * @param <T> The desired type.
+ * @param entityClass Type of the returned entities.
+ * @param pattern Is always case sensitive and may contain wildcard
+ * characters as follows: "?" for one matching character and
+ * "*" for a sequence of matching characters.
* @return Matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the entities.
+ * @throws DataAccessException Thrown if unable to retrieve the entities.
* @see #loadAll(Class)
*/
<T extends Entity> List<T> loadAll(Class<T> entityClass, String pattern) throws DataAccessException;
/**
- * Loads the parent entity for given child. Each modeled entity provides
- * public fields for available parent entity types e.g.:
+ * Loads the parent entity for given child. Each modeled entity provides public
+ * fields for available parent entity types e.g.:
*
* <pre>
* {
@@ -170,22 +157,17 @@
* }
* </pre>
*
- * @param <T>
- * The desired parent type.
- * @param child
- * The child entity.
- * @param entityClass
- * The desired parent entity type.
+ * @param <T> The desired parent type.
+ * @param child The child entity.
+ * @param entityClass The desired parent entity type.
* @return {@code Optional} is empty if parent entity could not be found.
- * @throws DataAccessException
- * Thrown if unable to retrieve parent entity.
+ * @throws DataAccessException Thrown if unable to retrieve parent entity.
*/
<T extends Entity> Optional<T> loadParent(Entity child, Class<T> entityClass) throws DataAccessException;
/**
* Loads all related children of given type for given parent entity. Each
- * modeled entity provides public fields for available child entity types
- * e.g.:
+ * modeled entity provides public fields for available child entity types e.g.:
*
* <pre>
* {
@@ -194,15 +176,11 @@
* }
* </pre>
*
- * @param <T>
- * The desired child type.
- * @param parent
- * The parent entity.
- * @param entityClass
- * The desired child entity type.
+ * @param <T> The desired child type.
+ * @param parent The parent entity.
+ * @param entityClass The desired child entity type.
* @return Related child entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the children.
+ * @throws DataAccessException Thrown if unable to retrieve the children.
* @see #loadChildren(Entity, Class, String)
*/
default <T extends Entity> List<T> loadChildren(Entity parent, Class<T> entityClass) throws DataAccessException {
@@ -210,9 +188,9 @@
}
/**
- * Loads all related children of given type for given parent entity whose
- * name fulfills the given pattern. Each modeled entity provides public
- * fields for available child entity types e.g.:
+ * Loads all related children of given type for given parent entity whose name
+ * fulfills the given pattern. Each modeled entity provides public fields for
+ * available child entity types e.g.:
*
* <pre>
* {
@@ -221,34 +199,27 @@
* }
* </pre>
*
- * @param <T>
- * The desired child type.
- * @param parent
- * The parent entity.
- * @param entityClass
- * The desired child entity type.
- * @param pattern
- * Is always case sensitive and may contain wildcard characters
- * as follows: "?" for one matching character and "*" for a
- * sequence of matching characters.
+ * @param <T> The desired child type.
+ * @param parent The parent entity.
+ * @param entityClass The desired child entity type.
+ * @param pattern Is always case sensitive and may contain wildcard
+ * characters as follows: "?" for one matching character and
+ * "*" for a sequence of matching characters.
* @return Matched child entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the children.
+ * @throws DataAccessException Thrown if unable to retrieve the children.
* @see #loadChildren(Entity, Class)
*/
<T extends Entity> List<T> loadChildren(Entity parent, Class<T> entityClass, String pattern)
throws DataAccessException;
/**
- * Queries available {@link ContextType} for given
- * {@link ContextDescribable}.
+ * Queries available {@link ContextType} for given {@link ContextDescribable}.
*
- * @param contextDescribable
- * Either a {@link TestStep} or a {@link Measurement}
+ * @param contextDescribable Either a {@link TestStep} or a {@link Measurement}
* @return {@code List} contains the {@code ContextType} of each referenced
* {@link ContextRoot}.
- * @throws DataAccessException
- * Thrown if unable to query the available {@code ContextType}s.
+ * @throws DataAccessException Thrown if unable to query the available
+ * {@code ContextType}s.
*/
List<ContextType> loadContextTypes(ContextDescribable contextDescribable) throws DataAccessException;
@@ -256,24 +227,22 @@
* Loads the requested {@link ContextRoot}s for given
* {@link ContextDescribable}.
*
- * @param contextDescribable
- * Either a {@link TestStep} or {@link Measurement}.
- * @param contextTypes
- * The requested context types. If omitted, all types are be
- * loaded.
- * @return The ordered contexts for given {@code TestStep} or the measured
- * ones for {@code Measurement} are returned in a {@code Map}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the {@code
- * ContextRoot}s.
+ * @param contextDescribable Either a {@link TestStep} or {@link Measurement}.
+ * @param contextTypes The requested context types. If omitted, all types
+ * are be loaded.
+ * @return The ordered contexts for given {@code TestStep} or the measured ones
+ * for {@code Measurement} are returned in a {@code Map}.
+ * @throws DataAccessException Thrown if unable to retrieve the {@code
+ * ContextRoot} s.
* @see ContextType
*/
Map<ContextType, ContextRoot> loadContexts(ContextDescribable contextDescribable, ContextType... contextTypes)
throws DataAccessException;
/**
- * @param entity The entity
- * @param relationName The name of the relation, which entities should be loaded.
+ * @param entity The entity
+ * @param relationName The name of the relation, which entities should be
+ * loaded.
* @param relatedClass Class of the related entities.
* @return The related entities for the given {@link Entity} and relationName
*/
@@ -283,12 +252,10 @@
* Retrieves the {@link MeasuredValues} as specified by the given
* {@link ReadRequest}.
*
- * @param readRequest
- * Provides all required informations to process the request.
- * @return Returns the {@code MeasuredValues} in a {@code List} as specified
- * in the given {@code ReadRequest}.
- * @throws DataAccessException
- * Thrown if unable to access the measured values.
+ * @param readRequest Provides all required informations to process the request.
+ * @return Returns the {@code MeasuredValues} in a {@code List} as specified in
+ * the given {@code ReadRequest}.
+ * @throws DataAccessException Thrown if unable to access the measured values.
*/
List<MeasuredValues> readMeasuredValues(ReadRequest readRequest) throws DataAccessException;
@@ -296,21 +263,23 @@
* Creates a new {@link Transaction} for modifying access.
*
* @return A new {@code Transaction} is returned.
- * @throws DataAccessException
- * Thrown if unable to create a new {@code Transaction}.
+ * @throws DataAccessException Thrown if unable to create a new
+ * {@code Transaction}.
*/
Transaction startTransaction() throws DataAccessException;
/**
- * Returns links to the given entities in the data store. The format of the links
- * is adapter specific and depends on the underlying data store. The links can be used by the client
- * to directly access the entities by bypassing the MDM API, if the client is capable of
- * accessing the adapters data store. The client can invoke {@link BaseApplicationContext#getAdapterType()}
- * to get the type of the adapter.
+ * Returns links to the given entities in the data store. The format of the
+ * links is adapter specific and depends on the underlying data store. The links
+ * can be used by the client to directly access the entities by bypassing the
+ * MDM API, if the client is capable of accessing the adapters data store. The
+ * client can invoke {@link BaseApplicationContext#getAdapterType()} to get the
+ * type of the adapter.
*
* @param entities the Entities for which the links are retrieved
- * @return the links to the given entities in the data store abstracted by the current adapter. The map
- * contains the requested entities as keys and the corresponding links as values.
+ * @return the links to the given entities in the data store abstracted by the
+ * current adapter. The map contains the requested entities as keys and
+ * the corresponding links as values.
*/
Map<Entity, String> getLinks(Collection<Entity> entities);
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/ConnectionException.java b/src/main/java/org/eclipse/mdm/api/base/ConnectionException.java
index b4d0d78..5294cae 100644
--- a/src/main/java/org/eclipse/mdm/api/base/ConnectionException.java
+++ b/src/main/java/org/eclipse/mdm/api/base/ConnectionException.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base;
@@ -36,8 +35,7 @@
/**
* Constructor.
*
- * @param message
- * The error message.
+ * @param message The error message.
*/
public ConnectionException(String message) {
super(message);
@@ -46,10 +44,8 @@
/**
* Constructor.
*
- * @param message
- * The error message.
- * @param throwable
- * The origin cause.
+ * @param message The error message.
+ * @param throwable The origin cause.
*/
public ConnectionException(String message, Throwable throwable) {
super(message, throwable);
diff --git a/src/main/java/org/eclipse/mdm/api/base/ServiceNotProvidedException.java b/src/main/java/org/eclipse/mdm/api/base/ServiceNotProvidedException.java
index 5e7c9d0..220a435 100644
--- a/src/main/java/org/eclipse/mdm/api/base/ServiceNotProvidedException.java
+++ b/src/main/java/org/eclipse/mdm/api/base/ServiceNotProvidedException.java
@@ -1,32 +1,32 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base;
-
-/**
- * This exception indicates that a service is not provided by an adapter.
- */
-public class ServiceNotProvidedException extends RuntimeException {
-
- private static final long serialVersionUID = -4829618036958929415L;
-
- /**
- * Constructor.
- *
- * @param clazz the service that is not provided
- */
- public ServiceNotProvidedException(Class<?> clazz) {
- super("The service '" + clazz + "' is not implemented!");
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+/**
+ * This exception indicates that a service is not provided by an adapter.
+ */
+public class ServiceNotProvidedException extends RuntimeException {
+
+ private static final long serialVersionUID = -4829618036958929415L;
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the service that is not provided
+ */
+ public ServiceNotProvidedException(Class<?> clazz) {
+ super("The service '" + clazz + "' is not implemented!");
+ }
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/Transaction.java b/src/main/java/org/eclipse/mdm/api/base/Transaction.java
index e1ebb64..27fb370 100644
--- a/src/main/java/org/eclipse/mdm/api/base/Transaction.java
+++ b/src/main/java/org/eclipse/mdm/api/base/Transaction.java
@@ -1,105 +1,94 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base;
-
-import java.util.Collection;
-
-import org.eclipse.mdm.api.base.massdata.WriteRequest;
-import org.eclipse.mdm.api.base.model.Deletable;
-import org.eclipse.mdm.api.base.model.Entity;
-import org.eclipse.mdm.api.base.model.MeasuredValues;
-import org.eclipse.mdm.api.base.query.DataAccessException;
-
-/**
- * Provides business layer write operations (CREATE, UPDATE, DELETE).
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- */
-public interface Transaction {
-
- // ======================================================================
- // Public methods
- // ======================================================================
-
- // TODO: it should be possible to a attach a listener
- // -> progress notification updates while uploading files
- // -> any other useful informations?!
-
- /**
- * Persists given entities and implicitly updates their instance IDs.
- *
- * @param <T>
- * Most common type of the given entities.
- * @param entities
- * Entities that will be persisted.
- * @throws DataAccessException
- * Thrown in case of errors while writing entities.
- */
- <T extends Entity> void create(Collection<T> entities) throws DataAccessException;
-
- /**
- * Updates given entities.
- *
- * @param <T>
- * Most common type of the given entities.
- * @param entities
- * Entities that will be updated.
- * @throws DataAccessException
- * Thrown in case of errors while writing entities.
- */
- <T extends Entity> void update(Collection<T> entities) throws DataAccessException;
-
- /**
- * Deletes given entities. Related children will be searched and
- * automatically removed.
- *
- * @param <T>
- * Most common type of the given entities.
- * @param entities
- * Entities that will be deleted (including their children).
- * @throws DataAccessException
- * Thrown in case of errors while deleting entities.
- */
- <T extends Deletable> void delete(Collection<T> entities) throws DataAccessException;
-
- /**
- * Creates {@link MeasuredValues} as specified by the given
- * {@link WriteRequest}s.
- *
- * @param writeRequests
- * Provides all required informations to process the request.
- * @throws DataAccessException
- * Thrown if unable to create specified measured values.
- */
- void writeMeasuredValues(Collection<WriteRequest> writeRequests) throws DataAccessException;
-
- /**
- * Commit this transaction. Any changes made within this transaction become
- * permanent.
- *
- * @throws DataAccessException
- * Thrown if unable to commit this transaction.
- */
- void commit() throws DataAccessException;
-
- /**
- * Aborts (rollback) this transaction. Any changes made within this
- * transaction will be lost.
- */
- void abort();
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+import java.util.Collection;
+
+import org.eclipse.mdm.api.base.massdata.WriteRequest;
+import org.eclipse.mdm.api.base.model.Deletable;
+import org.eclipse.mdm.api.base.model.Entity;
+import org.eclipse.mdm.api.base.model.MeasuredValues;
+import org.eclipse.mdm.api.base.query.DataAccessException;
+
+/**
+ * Provides business layer write operations (CREATE, UPDATE, DELETE).
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ */
+public interface Transaction {
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ // TODO: it should be possible to a attach a listener
+ // -> progress notification updates while uploading files
+ // -> any other useful informations?!
+
+ /**
+ * Persists given entities and implicitly updates their instance IDs.
+ *
+ * @param <T> Most common type of the given entities.
+ * @param entities Entities that will be persisted.
+ * @throws DataAccessException Thrown in case of errors while writing entities.
+ */
+ <T extends Entity> void create(Collection<T> entities) throws DataAccessException;
+
+ /**
+ * Updates given entities.
+ *
+ * @param <T> Most common type of the given entities.
+ * @param entities Entities that will be updated.
+ * @throws DataAccessException Thrown in case of errors while writing entities.
+ */
+ <T extends Entity> void update(Collection<T> entities) throws DataAccessException;
+
+ /**
+ * Deletes given entities. Related children will be searched and automatically
+ * removed.
+ *
+ * @param <T> Most common type of the given entities.
+ * @param entities Entities that will be deleted (including their children).
+ * @throws DataAccessException Thrown in case of errors while deleting entities.
+ */
+ <T extends Deletable> void delete(Collection<T> entities) throws DataAccessException;
+
+ /**
+ * Creates {@link MeasuredValues} as specified by the given
+ * {@link WriteRequest}s.
+ *
+ * @param writeRequests Provides all required informations to process the
+ * request.
+ * @throws DataAccessException Thrown if unable to create specified measured
+ * values.
+ */
+ void writeMeasuredValues(Collection<WriteRequest> writeRequests) throws DataAccessException;
+
+ /**
+ * Commit this transaction. Any changes made within this transaction become
+ * permanent.
+ *
+ * @throws DataAccessException Thrown if unable to commit this transaction.
+ */
+ void commit() throws DataAccessException;
+
+ /**
+ * Aborts (rollback) this transaction. Any changes made within this transaction
+ * will be lost.
+ */
+ void abort();
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/Attribute.java b/src/main/java/org/eclipse/mdm/api/base/adapter/Attribute.java
index be7cee5..4f91605 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/Attribute.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/Attribute.java
@@ -1,27 +1,25 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.adapter;
+import java.lang.reflect.Field;
+
import org.eclipse.mdm.api.base.model.Enumeration;
import org.eclipse.mdm.api.base.model.Value;
import org.eclipse.mdm.api.base.model.ValueType;
-import javax.xml.ws.Service;
-import java.lang.reflect.Field;
-
/**
* Represents a modeled attribute.
*
@@ -67,15 +65,14 @@
ValueType getValueType();
/**
- * Returns the enumeration {@code Class} associated with this
- * {@code Attribute}.
+ * Returns the enumeration {@code Class} associated with this {@code Attribute}.
*
- * @return The enumeration {@code Class} associated with this
- * {@code Attribute} is returned.
- * @throws IllegalStateException
- * Thrown if the {@link ValueType} of this {@code Attribute} is
- * neither {@link ValueType#ENUMERATION} nor
- * {@link ValueType#ENUMERATION_SEQUENCE}.
+ * @return The enumeration {@code Class} associated with this {@code Attribute}
+ * is returned.
+ * @throws IllegalStateException Thrown if the {@link ValueType} of this
+ * {@code Attribute} is neither
+ * {@link ValueType#ENUMERATION} nor
+ * {@link ValueType#ENUMERATION_SEQUENCE}.
*/
Enumeration<?> getEnumObj();
@@ -96,8 +93,7 @@
/**
* Creates a new {@link Value} with given initial value.
*
- * @param input
- * The initial value.
+ * @param input The initial value.
* @return Created {@code Value} is returned.
*/
default Value createValue(Object input) {
@@ -107,10 +103,8 @@
/**
* Creates a new {@link Value} with given unit name and initial value.
*
- * @param unit
- * The name of unit.
- * @param input
- * The initial value.
+ * @param unit The name of unit.
+ * @param input The initial value.
* @return Created {@code Value} is returned.
*/
default Value createValue(String unit, Object input) {
@@ -118,17 +112,14 @@
}
/**
- * Creates a new sequence {@link Value} with given unit name and initial
- * value.
+ * Creates a new sequence {@link Value} with given unit name and initial value.
*
- * @param unit
- * The name of unit.
- * @param input
- * The initial value.
+ * @param unit The name of unit.
+ * @param input The initial value.
* @return Created {@code Value} is returned.
*/
default Value createValueSeq(String unit, Object input) {
- if(getValueType().isEnumerationType()) {
+ if (getValueType().isEnumerationType()) {
return createEnumerationSequence(unit, input);
}
return createValueSequence(unit, input);
@@ -155,12 +146,9 @@
* Creates a new {@link Value} with given unit name, initial valid flag and
* value.
*
- * @param unit
- * The name of unit.
- * @param valid
- * The initial valid flag.
- * @param input
- * The initial value.
+ * @param unit The name of unit.
+ * @param valid The initial valid flag.
+ * @param input The initial value.
* @return Created {@code Value} is returned.
*/
default Value createValue(String unit, boolean valid, Object input) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/ChildrenStore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/ChildrenStore.java
index 3f48249..bf011bb 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/ChildrenStore.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/ChildrenStore.java
@@ -1,117 +1,110 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base.adapter;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.mdm.api.base.model.Deletable;
-
-/**
- * Holds related entities of any kind and keeps track of modifications.
- */
-public final class ChildrenStore {
-
- private final Map<Class<? extends Deletable>, List<? extends Deletable>> current = new HashMap<>(0);
- private final Map<Class<? extends Deletable>, List<? extends Deletable>> removed = new HashMap<>(0);
-
- /**
- * Returns current set of related children mapped by their type.
- *
- * @return Returned {@code Map} is unmodifiable.
- */
- public Map<Class<? extends Deletable>, List<? extends Deletable>> getCurrent() {
- return Collections.unmodifiableMap(current);
- }
-
- /**
- * Returns current set of removed related children mapped by their type.
- *
- * @return Returned {@code Map} is unmodifiable.
- */
- public Map<Class<? extends Deletable>, List<? extends Deletable>> getRemoved() {
- return Collections.unmodifiableMap(removed);
- }
-
- /**
- * Returns related child entities of given type.
- *
- * @param <T>
- * Desired entity type.
- * @param entityClass
- * Used as identifier.
- * @return Returned {@code List} is unmodifiable.
- */
- @SuppressWarnings("unchecked")
- public <T extends Deletable> List<T> get(Class<T> entityClass) {
- return Collections.unmodifiableList((List<T>) current.computeIfAbsent(entityClass, k -> new ArrayList<>()));
- }
-
- /**
- * Sorts the child entities with given {@code Comparator}.
- *
- * @param <T>
- * Desired entity type.
- * @param entityClass
- * Used as identifier.
- * @param comparator
- * Used for sorting.
- */
- @SuppressWarnings("unchecked")
- public <T extends Deletable> void sort(Class<T> entityClass, Comparator<? super T> comparator) {
- List<T> children = (List<T>) current.get(entityClass);
- if (children != null) {
- children.sort(comparator);
- }
- }
-
- /**
- * Adds given child entity.
- *
- * @param child
- * The new child.
- */
- @SuppressWarnings("unchecked")
- public void add(Deletable child) {
- removed.getOrDefault(child.getClass(), new ArrayList<>()).remove(child);
- ((List<Deletable>) current.computeIfAbsent(child.getClass(), k -> new ArrayList<>())).add(child);
- }
-
- /**
- * Removes given child entity.
- *
- * @param child
- * The child which will be removed.
- */
- @SuppressWarnings("unchecked")
- public void remove(Deletable child) {
- List<Deletable> children = (List<Deletable>) current.getOrDefault(child.getClass(), new ArrayList<>());
- if (children.remove(child) && child.getID() != null && child.getID().length() > 0) {
- ((List<Deletable>) removed.computeIfAbsent(child.getClass(), k -> new ArrayList<>())).add(child);
- }
- }
-
- /**
- * Clean up list of removed entities.
- */
- void apply() {
- removed.clear();
- }
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.adapter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.model.Deletable;
+
+/**
+ * Holds related entities of any kind and keeps track of modifications.
+ */
+public final class ChildrenStore {
+
+ private final Map<Class<? extends Deletable>, List<? extends Deletable>> current = new HashMap<>(0);
+ private final Map<Class<? extends Deletable>, List<? extends Deletable>> removed = new HashMap<>(0);
+
+ /**
+ * Returns current set of related children mapped by their type.
+ *
+ * @return Returned {@code Map} is unmodifiable.
+ */
+ public Map<Class<? extends Deletable>, List<? extends Deletable>> getCurrent() {
+ return Collections.unmodifiableMap(current);
+ }
+
+ /**
+ * Returns current set of removed related children mapped by their type.
+ *
+ * @return Returned {@code Map} is unmodifiable.
+ */
+ public Map<Class<? extends Deletable>, List<? extends Deletable>> getRemoved() {
+ return Collections.unmodifiableMap(removed);
+ }
+
+ /**
+ * Returns related child entities of given type.
+ *
+ * @param <T> Desired entity type.
+ * @param entityClass Used as identifier.
+ * @return Returned {@code List} is unmodifiable.
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Deletable> List<T> get(Class<T> entityClass) {
+ return Collections.unmodifiableList((List<T>) current.computeIfAbsent(entityClass, k -> new ArrayList<>()));
+ }
+
+ /**
+ * Sorts the child entities with given {@code Comparator}.
+ *
+ * @param <T> Desired entity type.
+ * @param entityClass Used as identifier.
+ * @param comparator Used for sorting.
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Deletable> void sort(Class<T> entityClass, Comparator<? super T> comparator) {
+ List<T> children = (List<T>) current.get(entityClass);
+ if (children != null) {
+ children.sort(comparator);
+ }
+ }
+
+ /**
+ * Adds given child entity.
+ *
+ * @param child The new child.
+ */
+ @SuppressWarnings("unchecked")
+ public void add(Deletable child) {
+ removed.getOrDefault(child.getClass(), new ArrayList<>()).remove(child);
+ ((List<Deletable>) current.computeIfAbsent(child.getClass(), k -> new ArrayList<>())).add(child);
+ }
+
+ /**
+ * Removes given child entity.
+ *
+ * @param child The child which will be removed.
+ */
+ @SuppressWarnings("unchecked")
+ public void remove(Deletable child) {
+ List<Deletable> children = (List<Deletable>) current.getOrDefault(child.getClass(), new ArrayList<>());
+ if (children.remove(child) && child.getID() != null && child.getID().length() > 0) {
+ ((List<Deletable>) removed.computeIfAbsent(child.getClass(), k -> new ArrayList<>())).add(child);
+ }
+ }
+
+ /**
+ * Clean up list of removed entities.
+ */
+ void apply() {
+ removed.clear();
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java b/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
index aec71eb..7a9eb32 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/Core.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.adapter;
import java.util.Arrays;
@@ -63,8 +62,7 @@
String getTypeName();
/**
- * Returns the instance ID or {@code 0} if this instance is not yet
- * persisted.
+ * Returns the instance ID or {@code 0} if this instance is not yet persisted.
*
* @return The instance ID is returned.
*/
@@ -73,8 +71,7 @@
/**
* Sets an instance ID.
*
- * @param instanceID
- * The new instance ID.
+ * @param instanceID The new instance ID.
*/
void setID(String instanceID);
@@ -87,11 +84,10 @@
/**
* Hides {@link Value} containers whose name is contained in the given names
- * {@code Collection}.
- * E.g. hide attributes from a CatalogComponent when not used in a TemplateComponent.
+ * {@code Collection}. E.g. hide attributes from a CatalogComponent when not
+ * used in a TemplateComponent.
*
- * @param names
- * Names of the {@code Value} which shall be hidden.
+ * @param names Names of the {@code Value} which shall be hidden.
*/
void hideValues(Collection<String> names);
@@ -149,10 +145,9 @@
}
/**
- * Applies modifications made to the entity stores and {@link Value}
- * containers. This method is called when a transaction is finalized
- * (all operations completed successfully) to reflect the new state in
- * the core.
+ * Applies modifications made to the entity stores and {@link Value} containers.
+ * This method is called when a transaction is finalized (all operations
+ * completed successfully) to reflect the new state in the core.
*/
default void apply() {
// apply the removed state to mutable entities
@@ -166,40 +161,39 @@
}
/**
- * Returns the mutable {@link EntityStore}.
- * Holds entities with mutable (editable) relations to the entity
- * bound to this core instance.
- * This store only contains always only one relation for one entity.
- * For child relations use {@link ChildrenStore}.
+ * Returns the mutable {@link EntityStore}. Holds entities with mutable
+ * (editable) relations to the entity bound to this core instance. This store
+ * only contains always only one relation for one entity. For child relations
+ * use {@link ChildrenStore}.
*
* @return The mutable {@code EntityStore} is returned.
*/
EntityStore getMutableStore();
/**
- * Returns the permanent {@link EntityStore}.
- * Holds entities with immutable (non-editable) relations to the entity
- * bound to this core instance.
- * E.g. relations to the parent entity.
+ * Returns the permanent {@link EntityStore}. Holds entities with immutable
+ * (non-editable) relations to the entity bound to this core instance. E.g.
+ * relations to the parent entity.
*
* @return The permanent {@code EntityStore} is returned.
*/
EntityStore getPermanentStore();
/**
- * Returns the {@link ChildrenStore}. This store holds child
- * entities with relations to the entity bound to this core instance.
- *
+ * Returns the {@link ChildrenStore}. This store holds child entities with
+ * relations to the entity bound to this core instance.
+ *
* @return The {@code ChildrenStore} is returned.
*/
// TODO (8.11.2017; Florian Schmitt, Angelika Wittek)
- // Entities with more than one related entity that do not refer to children, have also to go here,
- // as it is not permitted to go to the other stores. Does this work at all?
+ // Entities with more than one related entity that do not refer to children,
+ // have also to go here,
+ // as it is not permitted to go to the other stores. Does this work at all?
ChildrenStore getChildrenStore();
/**
- * Returns the {@link RelationStore}. This store holds related
- * entities for N to M relations.
+ * Returns the {@link RelationStore}. This store holds related entities for N to
+ * M relations.
*
* @return The {@link RelationStore} is returned
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
index e5a5bf8..c51e131 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/DefaultCore.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.adapter;
import java.util.Collection;
@@ -65,8 +64,7 @@
/**
* Constructs a new {@link Core} initialized with a queried {@link Record}.
*
- * @param record
- * The queried {@code Record}.
+ * @param record The queried {@code Record}.
*/
public DefaultCore(Record record) {
setID(record.getID());
@@ -84,8 +82,7 @@
/**
* Constructs a new empty {@link Core}. The ID is set to an empty String.
*
- * @param entityType
- * The associated {@link EntityType}.
+ * @param entityType The associated {@link EntityType}.
*/
public DefaultCore(EntityType entityType) {
setID("");
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/EntityStore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/EntityStore.java
index 42826a9..0bac51d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/EntityStore.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/EntityStore.java
@@ -1,199 +1,178 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base.adapter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.mdm.api.base.model.ContextType;
-import org.eclipse.mdm.api.base.model.Entity;
-
-/**
- * Holds related entities of any kind and keeps track of modifications.
- */
-public final class EntityStore {
-
- private final Map<String, Entity> current = new HashMap<>(0);
- private final Map<String, Entity> removed = new HashMap<>(0);
-
- /**
- * Returns current set of related entities.
- *
- * @return Returned {@code Collection} is unmodifiable.
- */
- public Collection<Entity> getCurrent() {
- return Collections.unmodifiableCollection(current.values());
- }
-
- /**
- * Returns current set of removed related entities.
- *
- * @return Returned {@code Collection} is unmodifiable.
- */
- public Collection<Entity> getRemoved() {
- return Collections.unmodifiableCollection(removed.values());
- }
-
- /**
- * Returns related entity identified by given entity class.
- *
- * @param <T>
- * The desired entity type.
- * @param entityClass
- * Used as identifier.
- * @return The related entity is returned or null of not defined.
- */
- public <T extends Entity> T get(Class<T> entityClass) {
- return get(entityClass.getSimpleName(), entityClass);
- }
-
- /**
- * Returns related entity identified by given entity class.
- *
- * @param <T>
- * The desired entity type.
- * @param relationName
- * The relation name the entity is referenced by.
- * @param entityClass
- * Used as identifier.
- * @return The related entity is returned or null of not defined.
- */
- public <T extends Entity> T get(String relationName, Class<T> entityClass) {
- return entityClass.cast(current.get(relationName));
- }
-
- /**
- * Replaces a related entity with the given one.
- *
- * @param entity
- * The new related entity.
- */
- public void set(Entity entity) {
- set(entity.getClass().getSimpleName(), entity);
- }
-
- /**
- * Replaces a related entity with the given one.
- *
- * @param name
- * The name of the relation the entity is referenced by.
- * @param entity
- * The new related entity.
- */
- public void set(String name, Entity entity) {
- Entity old = current.put(name, entity);
- if (old != null) {
- removed.put(name, old);
- }
- }
-
- /**
- * Removes a related entity for given entity class.
- *
- * @param entityClass
- * Used as identifier.
- */
- public void remove(Class<? extends Entity> entityClass) {
- String key = entityClass.getSimpleName();
- remove(key, entityClass);
- }
-
- /**
- * Removes a related entity for given relation name and entity class.
- *
- * @param name
- * The name of the relation the entity is referenced by.
- * @param entityClass
- * Used as identifier.
- */
- public void remove(String name, Class<? extends Entity> entityClass) {
- Entity old = current.remove(name);
- if (old != null) {
- removed.put(name, old);
- }
- }
-
- /**
- * Returns related entity identified by given entity class and
- * {@link ContextType}.
- *
- * @param <T>
- * The desired entity type.
- * @param entityClass
- * Used as identifier.
- * @param contextType
- * Used as identifier.
- * @return The related entity is returned or null of not defined.
- */
- public <T extends Entity> T get(Class<T> entityClass, ContextType contextType) {
- return entityClass.cast(current.get(createContextTypeKey(entityClass, contextType)));
- }
-
- /**
- * Replaces a related entity with the given one.
- *
- * @param entity
- * The new related entity.
- * @param contextType
- * Used as identifier.
- */
- public void set(Entity entity, ContextType contextType) {
- String key = createContextTypeKey(entity.getClass(), contextType);
- Entity old = current.put(key, entity);
- if (old != null) {
- removed.put(key, old);
- }
- }
-
- /**
- * Removes a related entity for given entity class and
- * {@link ContextType}.
- *
- * @param entityClass
- * Used as identifier.
- * @param contextType
- * Used as identifier.
- */
- public void remove(Class<? extends Entity> entityClass, ContextType contextType) {
- String key = createContextTypeKey(entityClass, contextType);
- Entity old = current.remove(key);
- if (old != null) {
- removed.put(key, old);
- }
- }
-
- /**
- * Clean up list of removed entities.
- */
- void apply() {
- removed.clear();
- }
-
- /**
- * Generates a key from given entity class and {@link ContextType}.
- *
- * @param entityClass
- * Identifier part 1.
- * @param contextType
- * Identifier part 2.
- * @return A context type dependent key is returned.
- */
- private static String createContextTypeKey(Class<? extends Entity> entityClass, ContextType contextType) {
- return entityClass.getSimpleName() + '_' + contextType;
- }
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.adapter;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.model.ContextType;
+import org.eclipse.mdm.api.base.model.Entity;
+
+/**
+ * Holds related entities of any kind and keeps track of modifications.
+ */
+public final class EntityStore {
+
+ private final Map<String, Entity> current = new HashMap<>(0);
+ private final Map<String, Entity> removed = new HashMap<>(0);
+
+ /**
+ * Returns current set of related entities.
+ *
+ * @return Returned {@code Collection} is unmodifiable.
+ */
+ public Collection<Entity> getCurrent() {
+ return Collections.unmodifiableCollection(current.values());
+ }
+
+ /**
+ * Returns current set of removed related entities.
+ *
+ * @return Returned {@code Collection} is unmodifiable.
+ */
+ public Collection<Entity> getRemoved() {
+ return Collections.unmodifiableCollection(removed.values());
+ }
+
+ /**
+ * Returns related entity identified by given entity class.
+ *
+ * @param <T> The desired entity type.
+ * @param entityClass Used as identifier.
+ * @return The related entity is returned or null of not defined.
+ */
+ public <T extends Entity> T get(Class<T> entityClass) {
+ return get(entityClass.getSimpleName(), entityClass);
+ }
+
+ /**
+ * Returns related entity identified by given entity class.
+ *
+ * @param <T> The desired entity type.
+ * @param relationName The relation name the entity is referenced by.
+ * @param entityClass Used as identifier.
+ * @return The related entity is returned or null of not defined.
+ */
+ public <T extends Entity> T get(String relationName, Class<T> entityClass) {
+ return entityClass.cast(current.get(relationName));
+ }
+
+ /**
+ * Replaces a related entity with the given one.
+ *
+ * @param entity The new related entity.
+ */
+ public void set(Entity entity) {
+ set(entity.getClass().getSimpleName(), entity);
+ }
+
+ /**
+ * Replaces a related entity with the given one.
+ *
+ * @param name The name of the relation the entity is referenced by.
+ * @param entity The new related entity.
+ */
+ public void set(String name, Entity entity) {
+ Entity old = current.put(name, entity);
+ if (old != null) {
+ removed.put(name, old);
+ }
+ }
+
+ /**
+ * Removes a related entity for given entity class.
+ *
+ * @param entityClass Used as identifier.
+ */
+ public void remove(Class<? extends Entity> entityClass) {
+ String key = entityClass.getSimpleName();
+ remove(key, entityClass);
+ }
+
+ /**
+ * Removes a related entity for given relation name and entity class.
+ *
+ * @param name The name of the relation the entity is referenced by.
+ * @param entityClass Used as identifier.
+ */
+ public void remove(String name, Class<? extends Entity> entityClass) {
+ Entity old = current.remove(name);
+ if (old != null) {
+ removed.put(name, old);
+ }
+ }
+
+ /**
+ * Returns related entity identified by given entity class and
+ * {@link ContextType}.
+ *
+ * @param <T> The desired entity type.
+ * @param entityClass Used as identifier.
+ * @param contextType Used as identifier.
+ * @return The related entity is returned or null of not defined.
+ */
+ public <T extends Entity> T get(Class<T> entityClass, ContextType contextType) {
+ return entityClass.cast(current.get(createContextTypeKey(entityClass, contextType)));
+ }
+
+ /**
+ * Replaces a related entity with the given one.
+ *
+ * @param entity The new related entity.
+ * @param contextType Used as identifier.
+ */
+ public void set(Entity entity, ContextType contextType) {
+ String key = createContextTypeKey(entity.getClass(), contextType);
+ Entity old = current.put(key, entity);
+ if (old != null) {
+ removed.put(key, old);
+ }
+ }
+
+ /**
+ * Removes a related entity for given entity class and {@link ContextType}.
+ *
+ * @param entityClass Used as identifier.
+ * @param contextType Used as identifier.
+ */
+ public void remove(Class<? extends Entity> entityClass, ContextType contextType) {
+ String key = createContextTypeKey(entityClass, contextType);
+ Entity old = current.remove(key);
+ if (old != null) {
+ removed.put(key, old);
+ }
+ }
+
+ /**
+ * Clean up list of removed entities.
+ */
+ void apply() {
+ removed.clear();
+ }
+
+ /**
+ * Generates a key from given entity class and {@link ContextType}.
+ *
+ * @param entityClass Identifier part 1.
+ * @param contextType Identifier part 2.
+ * @return A context type dependent key is returned.
+ */
+ private static String createContextTypeKey(Class<? extends Entity> entityClass, ContextType contextType) {
+ return entityClass.getSimpleName() + '_' + contextType;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/EntityType.java b/src/main/java/org/eclipse/mdm/api/base/adapter/EntityType.java
index 6b118ca..91f5cd3 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/EntityType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/EntityType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.adapter;
@@ -106,12 +105,10 @@
* corresponding relation {@code Attribute} (foreign key) as returned by
* {@link Relation#getAttribute()}.
*
- * @param name
- * The {@code Attribute} identifier.
+ * @param name The {@code Attribute} identifier.
* @return The associated {@code Attribute} is returned.
- * @throws IllegalArgumentException
- * Thrown if neither an {@code Attribute} nor a {@link Relation}
- * with given name exists.
+ * @throws IllegalArgumentException Thrown if neither an {@code Attribute} nor a
+ * {@link Relation} with given name exists.
*/
Attribute getAttribute(String name);
@@ -148,46 +145,38 @@
/**
* Returns all {@link Relation}s whose relationship is of the given type.
*
- * @param relationType
- * The relationship type.
+ * @param relationType The relationship type.
* @return The returned {@code List} may be immutable.
*/
List<Relation> getRelations(RelationType relationType);
/**
- * Returns a {@link Relation} to given target entity type. At first it is
- * tried to find a unambiguous {@code Relation} to given {@code EntityType}.
- * If this fails it is tried to identify it by the name of the given
- * {@link EntityType}.
+ * Returns a {@link Relation} to given target entity type. At first it is tried
+ * to find a unambiguous {@code Relation} to given {@code EntityType}. If this
+ * fails it is tried to identify it by the name of the given {@link EntityType}.
*
- * @param target
- * Used as identifier.
+ * @param target Used as identifier.
* @return The associated {@code Relation} is returned.
- * @throws IllegalArgumentException
- * Thrown if a relation to given target entity type does not
- * exist.
+ * @throws IllegalArgumentException Thrown if a relation to given target entity
+ * type does not exist.
*/
Relation getRelation(EntityType target);
/**
- * Returns the {@link Relation} with given target entity type and relation
- * name.
+ * Returns the {@link Relation} with given target entity type and relation name.
*
- * @param target
- * The target entity type of the requested {@code Relation}.
- * @param name
- * The name of the requested {@code Relation}.
+ * @param target The target entity type of the requested {@code Relation}.
+ * @param name The name of the requested {@code Relation}.
* @return The associated {@code Relation} is returned.
- * @throws IllegalArgumentException
- * Thrown if {@code Relation} with given target entity type and
- * name does not exist.
+ * @throws IllegalArgumentException Thrown if {@code Relation} with given target
+ * entity type and name does not exist.
* @see #getRelation(EntityType)
*/
Relation getRelation(EntityType target, String name);
/**
- * Creates for each {@link Attribute} a corresponding empty {@link Value}
- * and returns them mapped by their name.
+ * Creates for each {@link Attribute} a corresponding empty {@link Value} and
+ * returns them mapped by their name.
*
* @return Returns created empty {@code Value}s mapped by their name.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/ModelManager.java b/src/main/java/org/eclipse/mdm/api/base/adapter/ModelManager.java
index 91c0e0b..2ebf6dc 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/ModelManager.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/ModelManager.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.adapter;
@@ -46,8 +45,7 @@
/**
* Returns the {@link EntityType} associated with given {@link Entity}.
*
- * @param entity
- * Its type name is used as identifier.
+ * @param entity Its type name is used as identifier.
* @return {@code EntityType} associated with given entity is returned.
*/
default EntityType getEntityType(Entity entity) {
@@ -57,12 +55,10 @@
/**
* Returns the {@link EntityType} associated with given entity class type.
*
- * @param entityClass
- * Used as identifier.
- * @return {@code EntityType} associated with given entity class is
- * returned.
- * @throws IllegalArgumentException
- * Thrown if {@code EntityType} for given type does not exist.
+ * @param entityClass Used as identifier.
+ * @return {@code EntityType} associated with given entity class is returned.
+ * @throws IllegalArgumentException Thrown if {@code EntityType} for given type
+ * does not exist.
*/
EntityType getEntityType(Class<? extends Entity> entityClass);
@@ -70,36 +66,32 @@
* Returns the {@link EntityType} associated with given entity class and
* {@link ContextType}.
*
- * @param entityClass
- * Used as identifier.
- * @param contextType
- * Used as identifier.
+ * @param entityClass Used as identifier.
+ * @param contextType Used as identifier.
* @return {@code EntityType} associated with given entity class and {@code
* ContextType} is returned.
- * @throws IllegalArgumentException
- * Thrown if {@code EntityType} for given type does not exist.
+ * @throws IllegalArgumentException Thrown if {@code EntityType} for given type
+ * does not exist.
*/
EntityType getEntityType(Class<? extends Entity> entityClass, ContextType contextType);
/**
* Returns the {@link EntityType} identified by given name.
*
- * @param name
- * Used as identifier.
+ * @param name Used as identifier.
* @return {@code EntityType} with given name is returned.
- * @throws IllegalArgumentException
- * Thrown if {@code EntityType} with given name does not exist.
+ * @throws IllegalArgumentException Thrown if {@code EntityType} with given name
+ * does not exist.
*/
EntityType getEntityType(String name);
/**
* Returns the {@link EntityType} identified by given ID.
*
- * @param id
- * Used as ID.
+ * @param id Used as ID.
* @return {@code EntityType} with given ID is returned.
- * @throws IllegalArgumentException
- * Thrown if {@code EntityType} with given ID does not exist.
+ * @throws IllegalArgumentException Thrown if {@code EntityType} with given ID
+ * does not exist.
*/
EntityType getEntityTypeById(String id);
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java b/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
index f281524..d6f40e3 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/Relation.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.adapter;
import org.eclipse.mdm.api.base.model.Value;
@@ -84,30 +83,27 @@
*/
@Override
String toString();
-
+
/**
- * Checks whether this relation is of the same {@link RelationType} as the
- * given one and whether the foreign key is in the table of the source
- * entity type (or, in other words, if there may be at most 1 related
- * destination object).
+ * Checks whether this relation is of the same {@link RelationType} as the given
+ * one and whether the foreign key is in the table of the source entity type
+ * (or, in other words, if there may be at most 1 related destination object).
*
- * @param relationType
- * The {@code RelationType}.
- * @return Returns {@code true} this relation's {@code RelationType} is
- * equal with the given one and it is is an outgoing relation.
+ * @param relationType The {@code RelationType}.
+ * @return Returns {@code true} this relation's {@code RelationType} is equal
+ * with the given one and it is is an outgoing relation.
*/
boolean isOutgoing(RelationType relationType);
-
+
/**
- * Checks whether this relation is of the same {@link RelationType} as the
- * given one and whether the foreign key is in the table of the target
- * entity type (or, in other words, if there may be more than one related
- * destination objects).
+ * Checks whether this relation is of the same {@link RelationType} as the given
+ * one and whether the foreign key is in the table of the target entity type
+ * (or, in other words, if there may be more than one related destination
+ * objects).
*
- * @param relationType
- * The {@code RelationType}.
- * @return Returns {@code true} this relation's {@code RelationType} is
- * equal with the given one and it is is an incoming relation.
+ * @param relationType The {@code RelationType}.
+ * @return Returns {@code true} this relation's {@code RelationType} is equal
+ * with the given one and it is is an incoming relation.
*/
boolean isIncoming(RelationType relationType);
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java
index 9c2e7b6..c93e522 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationStore.java
@@ -52,10 +52,8 @@
/**
* Returns related child entities of given type.
*
- * @param <T>
- * Desired entity type.
- * @param entityClass
- * Used as identifier.
+ * @param <T> Desired entity type.
+ * @param entityClass Used as identifier.
* @return Returned {@code List} is unmodifiable.
*/
@SuppressWarnings("unchecked")
@@ -66,12 +64,9 @@
/**
* Sorts the child entities with given {@code Comparator}.
*
- * @param <T>
- * Desired entity type.
- * @param entityClass
- * Used as identifier.
- * @param comparator
- * Used for sorting.
+ * @param <T> Desired entity type.
+ * @param entityClass Used as identifier.
+ * @param comparator Used for sorting.
*/
@SuppressWarnings("unchecked")
public <T extends Deletable> void sort(String relation, Comparator<? super T> comparator) {
@@ -84,8 +79,7 @@
/**
* Adds given child entity.
*
- * @param child
- * The new child.
+ * @param child The new child.
*/
@SuppressWarnings("unchecked")
public void add(String relation, Deletable relatedEntity) {
@@ -96,8 +90,7 @@
/**
* Removes given child entity.
*
- * @param relatedEntity
- * The child which will be removed.
+ * @param relatedEntity The child which will be removed.
*/
@SuppressWarnings("unchecked")
public void remove(String relation, Deletable relatedEntity) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/adapter/RelationType.java b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationType.java
index 5548beb..abbf82a 100644
--- a/src/main/java/org/eclipse/mdm/api/base/adapter/RelationType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/adapter/RelationType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.adapter;
@@ -37,8 +36,8 @@
FATHER_CHILD,
/**
- * Represents an informational relation between two {@link EntityType}s
- * e.g.: {@code Measurement} and {@code ParameterSet}.
+ * Represents an informational relation between two {@link EntityType}s e.g.:
+ * {@code Measurement} and {@code ParameterSet}.
*/
INFO,
diff --git a/src/main/java/org/eclipse/mdm/api/base/file/FileService.java b/src/main/java/org/eclipse/mdm/api/base/file/FileService.java
index a822dc4..304889d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/file/FileService.java
+++ b/src/main/java/org/eclipse/mdm/api/base/file/FileService.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.file;
@@ -39,14 +38,10 @@
* Sequential download of given {@link FileLink}s into given target {@code
* Path}. Remote paths linked multiple times are downloaded only once.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLinks
- * Collection of {@code FileLink}s to download.
- * @throws IOException
- * Thrown if unable to download files.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLinks Collection of {@code FileLink}s to download.
+ * @throws IOException Thrown if unable to download files.
*/
default void downloadSequential(Entity entity, Path target, Collection<FileLink> fileLinks) throws IOException {
downloadSequential(entity, target, fileLinks, null);
@@ -57,16 +52,11 @@
* Path}. Remote paths linked multiple times are downloaded only once. The
* download progress may be traced with a progress listener.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLinks
- * Collection of {@code FileLink}s to download.
- * @param progressListener
- * The progress listener.
- * @throws IOException
- * Thrown if unable to download files.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLinks Collection of {@code FileLink}s to download.
+ * @param progressListener The progress listener.
+ * @throws IOException Thrown if unable to download files.
*/
void downloadSequential(Entity entity, Path target, Collection<FileLink> fileLinks,
ProgressListener progressListener) throws IOException;
@@ -75,14 +65,10 @@
* Parallel download of given {@link FileLink}s into given target {@code
* Path}. Remote paths linked multiple times are downloaded only once.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLinks
- * Collection of {@code FileLink}s to download.
- * @throws IOException
- * Thrown if unable to download files.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLinks Collection of {@code FileLink}s to download.
+ * @throws IOException Thrown if unable to download files.
*/
default void downloadParallel(Entity entity, Path target, Collection<FileLink> fileLinks) throws IOException {
downloadParallel(entity, target, fileLinks, null);
@@ -93,16 +79,11 @@
* Path}. Remote paths linked multiple times are downloaded only once. The
* download progress may be traced with a progress listener.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLinks
- * Collection of {@code FileLink}s to download.
- * @param progressListener
- * The progress listener.
- * @throws IOException
- * Thrown if unable to download files.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLinks Collection of {@code FileLink}s to download.
+ * @param progressListener The progress listener.
+ * @throws IOException Thrown if unable to download files.
*/
void downloadParallel(Entity entity, Path target, Collection<FileLink> fileLinks, ProgressListener progressListener)
throws IOException;
@@ -110,40 +91,31 @@
/**
* Downloads given {@link FileLink} into given target {@code Path}.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLink
- * The {@code FileLink} to download.
- * @throws IOException
- * Thrown if unable to download file.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLink The {@code FileLink} to download.
+ * @throws IOException Thrown if unable to download file.
*/
default void download(Entity entity, Path target, FileLink fileLink) throws IOException {
download(entity, target, fileLink, null);
}
/**
- * Downloads given {@link FileLink} into given target {@code Path}. The
- * download progress may be traced with a progress listener.
+ * Downloads given {@link FileLink} into given target {@code Path}. The download
+ * progress may be traced with a progress listener.
*
- * @param entity
- * Used for security checks.
- * @param target
- * Must be a directory.
- * @param fileLink
- * The {@code FileLink} to download.
- * @param progressListener
- * The progress listener.
- * @throws IOException
- * Thrown if unable to download file.
+ * @param entity Used for security checks.
+ * @param target Must be a directory.
+ * @param fileLink The {@code FileLink} to download.
+ * @param progressListener The progress listener.
+ * @throws IOException Thrown if unable to download file.
*/
void download(Entity entity, Path target, FileLink fileLink, ProgressListener progressListener) throws IOException;
/**
- * Opens an {@code InputStream} for given {@link FileLink}. The returned
- * stream should be consumed with a try-with-resources statement to ensure
- * the stream is closed properly, e.g:
+ * Opens an {@code InputStream} for given {@link FileLink}. The returned stream
+ * should be consumed with a try-with-resources statement to ensure the stream
+ * is closed properly, e.g:
*
* <pre>
* try (InputStream is = openStream(entity, fileLink)) {
@@ -151,23 +123,20 @@
* }
* </pre>
*
- * @param entity
- * Used for security checks.
- * @param fileLink
- * The {@code FileLink} to be provided as a stream.
+ * @param entity Used for security checks.
+ * @param fileLink The {@code FileLink} to be provided as a stream.
* @return A consumable {@code InputStream} is returned.
- * @throws IOException
- * Thrown if unable to provide as stream.
+ * @throws IOException Thrown if unable to provide as stream.
*/
default InputStream openStream(Entity entity, FileLink fileLink) throws IOException {
return openStream(entity, fileLink, null);
}
/**
- * Opens an {@code InputStream} for given {@link FileLink}. The progress of
- * the stream consumption may be traced with a progress listener. The
- * returned stream should be consumed with a try-with-resources statement to
- * ensure the stream is closed properly, e.g:
+ * Opens an {@code InputStream} for given {@link FileLink}. The progress of the
+ * stream consumption may be traced with a progress listener. The returned
+ * stream should be consumed with a try-with-resources statement to ensure the
+ * stream is closed properly, e.g:
*
* <pre>
* try (InputStream is = openStream(entity, fileLink)) {
@@ -175,28 +144,21 @@
* }
* </pre>
*
- * @param entity
- * Used for security checks.
- * @param fileLink
- * The {@code FileLink} to be provided as a stream.
- * @param progressListener
- * The progress listener.
+ * @param entity Used for security checks.
+ * @param fileLink The {@code FileLink} to be provided as a stream.
+ * @param progressListener The progress listener.
* @return A consumable {@code InputStream} is returned.
- * @throws IOException
- * Thrown if unable to provide as stream.
+ * @throws IOException Thrown if unable to provide as stream.
*/
InputStream openStream(Entity entity, FileLink fileLink, ProgressListener progressListener) throws IOException;
/**
- * Loads the file size for given {@link FileLink}. The file size is stored
- * in the given {@code FileLink}.
+ * Loads the file size for given {@link FileLink}. The file size is stored in
+ * the given {@code FileLink}.
*
- * @param entity
- * Used for security checks.
- * @param fileLink
- * The {@code FileLink} whose file size is requested.
- * @throws IOException
- * Thrown if unable to load file size.
+ * @param entity Used for security checks.
+ * @param fileLink The {@code FileLink} whose file size is requested.
+ * @throws IOException Thrown if unable to load file size.
*/
void loadSize(Entity entity, FileLink fileLink) throws IOException;
@@ -205,8 +167,8 @@
// ======================================================================
/**
- * A {@link FileService} consumer may implement this interface to get
- * notified about stream or download progress.
+ * A {@link FileService} consumer may implement this interface to get notified
+ * about stream or download progress.
*/
@FunctionalInterface
interface ProgressListener {
@@ -214,10 +176,8 @@
/**
* Progress notification.
*
- * @param bytes
- * Number of transferred bytes since last notification.
- * @param percent
- * The overall percentage, where percent p ∈ [0.0, 1.0].
+ * @param bytes Number of transferred bytes since last notification.
+ * @param percent The overall percentage, where percent p ∈ [0.0, 1.0].
*/
void progress(int bytes, float percent);
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/AnyTypeValuesBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/AnyTypeValuesBuilder.java
index 0e68f8b..40cec28 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/AnyTypeValuesBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/AnyTypeValuesBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -58,8 +57,7 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} given values will be added to.
+ * @param writeRequest The {@link WriteRequest} given values will be added to.
*/
AnyTypeValuesBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -70,12 +68,11 @@
// ======================================================================
/**
- * Adds given {@code String} values to the {@link WriteRequest} with a
- * global validity flag, which means the given sequence does not contain any
+ * Adds given {@code String} values to the {@link WriteRequest} with a global
+ * validity flag, which means the given sequence does not contain any
* {@code null} values.
*
- * @param values
- * The {@code String} array sequence.
+ * @param values The {@code String} array sequence.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer stringValues(String[] values) {
@@ -84,13 +81,11 @@
}
/**
- * Adds given {@code String} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code String} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code String} array sequence.
- * @param flags
- * The validity flags for each {@code String} value.
+ * @param values The {@code String} array sequence.
+ * @param flags The validity flags for each {@code String} value.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer stringValues(String[] values, boolean[] flags) {
@@ -99,12 +94,11 @@
}
/**
- * Adds given {@code LocalDateTime} values to the {@link WriteRequest} with
- * a global validity flag, which means the given sequence does not contain
- * any {@code null} values.
+ * Adds given {@code LocalDateTime} values to the {@link WriteRequest} with a
+ * global validity flag, which means the given sequence does not contain any
+ * {@code null} values.
*
- * @param values
- * The {@code LocalDateTime} array sequence.
+ * @param values The {@code LocalDateTime} array sequence.
* @return The {@link IndependentBuilder} is returned.
*/
public IndependentBuilder dateValues(LocalDateTime[] values) {
@@ -113,13 +107,11 @@
}
/**
- * Adds given {@code LocalDateTime} values to the {@link WriteRequest} with
- * a validity flag for each given value.
+ * Adds given {@code LocalDateTime} values to the {@link WriteRequest} with a
+ * validity flag for each given value.
*
- * @param values
- * The {@code LocalDateTime} array sequence.
- * @param flags
- * The validity flags for each {@code LocalDateTime} value.
+ * @param values The {@code LocalDateTime} array sequence.
+ * @param flags The validity flags for each {@code LocalDateTime} value.
* @return The {@link IndependentBuilder} is returned.
*/
public IndependentBuilder dateValues(LocalDateTime[] values, boolean[] flags) {
@@ -128,11 +120,10 @@
}
/**
- * Adds given {@code boolean} values to the {@link WriteRequest} with a
- * global validity flag.
+ * Adds given {@code boolean} values to the {@link WriteRequest} with a global
+ * validity flag.
*
- * @param values
- * The {@code boolean} array sequence.
+ * @param values The {@code boolean} array sequence.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer booleanValues(boolean[] values) {
@@ -141,13 +132,11 @@
}
/**
- * Adds given {@code boolean} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code boolean} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code boolean} array sequence.
- * @param flags
- * The validity flags for each {@code boolean} value.
+ * @param values The {@code boolean} array sequence.
+ * @param flags The validity flags for each {@code boolean} value.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer booleanValues(boolean[] values, boolean[] flags) {
@@ -156,12 +145,11 @@
}
/**
- * Adds given {@code byte[]} values to the {@link WriteRequest} with a
- * global validity flag, which means the given sequence does not contain any
+ * Adds given {@code byte[]} values to the {@link WriteRequest} with a global
+ * validity flag, which means the given sequence does not contain any
* {@code null} values.
*
- * @param values
- * The {@code byte[]} array sequence.
+ * @param values The {@code byte[]} array sequence.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer byteStreamValues(byte[][] values) {
@@ -170,13 +158,11 @@
}
/**
- * Adds given {@code byte[]} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code byte[]} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code byte[]} array sequence.
- * @param flags
- * The validity flags for each {@code byte[]} value.
+ * @param values The {@code byte[]} array sequence.
+ * @param flags The validity flags for each {@code byte[]} value.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer byteStreamValues(byte[][] values, boolean[] flags) {
@@ -185,12 +171,11 @@
}
/**
- * Adds given {@link FileLink} values to the {@link WriteRequest} with a
- * global validity flag, which means the given sequence does not contain any
+ * Adds given {@link FileLink} values to the {@link WriteRequest} with a global
+ * validity flag, which means the given sequence does not contain any
* {@code null} values.
*
- * @param values
- * The {@code FileLink} array sequence.
+ * @param values The {@code FileLink} array sequence.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer fileLinkValues(FileLink[] values) {
@@ -202,10 +187,8 @@
* Adds given {@link FileLink} values to the {@link WriteRequest} with a
* validity flag for each given value.
*
- * @param values
- * The {@code FileLink} array sequence.
- * @param flags
- * The validity flags for each {@code FileLink} value.
+ * @param values The {@code FileLink} array sequence.
+ * @param flags The validity flags for each {@code FileLink} value.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer fileLinkValues(FileLink[] values, boolean[] flags) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/BaseValuesBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/BaseValuesBuilder.java
index c167111..e6da859 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/BaseValuesBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/BaseValuesBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -41,9 +40,8 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} given values and corresponding
- * {@link ScalarType} will be applied to.
+ * @param writeRequest The {@link WriteRequest} given values and corresponding
+ * {@link ScalarType} will be applied to.
*/
BaseValuesBuilder(WriteRequest writeRequest) {
this.writeRequest = writeRequest;
@@ -54,14 +52,12 @@
// ======================================================================
/**
- * Adds given value sequence and sets the corresponding {@link ScalarType}
- * as the raw {@code ScalarType}.
+ * Adds given value sequence and sets the corresponding {@link ScalarType} as
+ * the raw {@code ScalarType}.
*
- * @param scalarType
- * The {@code ScalarType}.
- * @param values
- * The array value sequence must be assignment compatible with
- * the type represented by the given {@code ScalarType}.
+ * @param scalarType The {@code ScalarType}.
+ * @param values The array value sequence must be assignment compatible with
+ * the type represented by the given {@code ScalarType}.
*/
protected final void createValues(ScalarType scalarType, Object values) {
if (values == null) {
@@ -76,13 +72,10 @@
* Adds given value sequence, associated validity flags and sets the
* corresponding {@link ScalarType} as the raw {@code ScalarType}.
*
- * @param scalarType
- * The {@code ScalarType}.
- * @param values
- * The array value sequence must be assignment compatible with
- * the type represented by the given {@code ScalarType}.
- * @param flags
- * The validity flags for each value in the values sequence.
+ * @param scalarType The {@code ScalarType}.
+ * @param values The array value sequence must be assignment compatible with
+ * the type represented by the given {@code ScalarType}.
+ * @param flags The validity flags for each value in the values sequence.
*/
protected final void createValues(ScalarType scalarType, Object values, boolean[] flags) {
if (values == null || flags == null) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ComplexNumericalValuesBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ComplexNumericalValuesBuilder.java
index c1e80f6..5de2539 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ComplexNumericalValuesBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ComplexNumericalValuesBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -51,8 +50,7 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} given values will be added to.
+ * @param writeRequest The {@link WriteRequest} given values will be added to.
*/
ComplexNumericalValuesBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -67,8 +65,7 @@
* global validity flag, which means the given sequence does not contain any
* {@code null} values.
*
- * @param values
- * The {@code FloatComplex} array sequence.
+ * @param values The {@code FloatComplex} array sequence.
* @return The {@link UnitBuilder} is returned.
*/
public final UnitBuilder floatComplexValues(FloatComplex[] values) {
@@ -80,10 +77,8 @@
* Adds given {@link FloatComplex} values to the {@link WriteRequest} with a
* validity flag for each given value.
*
- * @param values
- * The {@code FloatComplex} array sequence.
- * @param flags
- * The validity flags for each {@code FloatComplex} value.
+ * @param values The {@code FloatComplex} array sequence.
+ * @param flags The validity flags for each {@code FloatComplex} value.
* @return The {@link UnitBuilder} is returned.
*/
public final UnitBuilder floatComplexValues(FloatComplex[] values, boolean[] flags) {
@@ -92,12 +87,11 @@
}
/**
- * Adds given {@link DoubleComplex} values to the {@link WriteRequest} with
- * a global validity flag, which means the given sequence does not contain
- * any {@code null} values.
+ * Adds given {@link DoubleComplex} values to the {@link WriteRequest} with a
+ * global validity flag, which means the given sequence does not contain any
+ * {@code null} values.
*
- * @param values
- * The {@code DoubleComplex} array sequence.
+ * @param values The {@code DoubleComplex} array sequence.
* @return The {@link UnitBuilder} is returned.
*/
public final UnitBuilder doubleComplexValues(DoubleComplex[] values) {
@@ -106,13 +100,11 @@
}
/**
- * Adds given {@link DoubleComplex} values to the {@link WriteRequest} with
- * a validity flag for each given value.
+ * Adds given {@link DoubleComplex} values to the {@link WriteRequest} with a
+ * validity flag for each given value.
*
- * @param values
- * The {@code DoubleComplex} array sequence.
- * @param flags
- * The validity flags for each {@code DoubleComplex} value.
+ * @param values The {@code DoubleComplex} array sequence.
+ * @param flags The validity flags for each {@code DoubleComplex} value.
* @return The {@link UnitBuilder} is returned.
*/
public final UnitBuilder doubleComplexValues(DoubleComplex[] values, boolean[] flags) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ExternalComponent.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ExternalComponent.java
index ce1f399..02c2084 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ExternalComponent.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ExternalComponent.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
index 9e303d9..fe0a37e 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/IndependentBuilder.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.massdata;
import org.eclipse.mdm.api.base.model.Channel;
@@ -48,9 +47,8 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest}, whose measured values of the
- * underlying {@link Channel} may be marked as independent.
+ * @param writeRequest The {@link WriteRequest}, whose measured values of the
+ * underlying {@link Channel} may be marked as independent.
*/
IndependentBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -70,7 +68,7 @@
getWriteRequest().setIndependent();
return this;
}
-
+
/**
* Triggers the measured values of the underlying {@link Channel} to be
* independent or not, depending on the value specified.
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/NumericalValuesBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/NumericalValuesBuilder.java
index 9b5ac5f..bbaaf13 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/NumericalValuesBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/NumericalValuesBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -47,8 +46,7 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} given values will be added to.
+ * @param writeRequest The {@link WriteRequest} given values will be added to.
*/
NumericalValuesBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -62,8 +60,7 @@
* Adds given {@code byte} values to the {@link WriteRequest} with a global
* validity flag.
*
- * @param values
- * The {@code byte} array sequence.
+ * @param values The {@code byte} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder byteValues(byte[] values) {
@@ -72,13 +69,11 @@
}
/**
- * Adds given {@code byte} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code byte} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code byte} array sequence.
- * @param flags
- * The validity flags for each {@code byte} value.
+ * @param values The {@code byte} array sequence.
+ * @param flags The validity flags for each {@code byte} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder byteValues(byte[] values, boolean[] flags) {
@@ -90,8 +85,7 @@
* Adds given {@code short} values to the {@link WriteRequest} with a global
* validity flag.
*
- * @param values
- * The {@code short} array sequence.
+ * @param values The {@code short} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder shortValues(short[] values) {
@@ -100,13 +94,11 @@
}
/**
- * Adds given {@code short} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code short} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code short} array sequence.
- * @param flags
- * The validity flags for each {@code short} value.
+ * @param values The {@code short} array sequence.
+ * @param flags The validity flags for each {@code short} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder shortValues(short[] values, boolean[] flags) {
@@ -118,8 +110,7 @@
* Adds given {@code int} values to the {@link WriteRequest} with a global
* validity flag.
*
- * @param values
- * The {@code int} array sequence.
+ * @param values The {@code int} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder integerValues(int[] values) {
@@ -131,10 +122,8 @@
* Adds given {@code int} values to the {@link WriteRequest} with a validity
* flag for each given value.
*
- * @param values
- * The {@code int} array sequence.
- * @param flags
- * The validity flags for each {@code int} value.
+ * @param values The {@code int} array sequence.
+ * @param flags The validity flags for each {@code int} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder integerValues(int[] values, boolean[] flags) {
@@ -146,8 +135,7 @@
* Adds given {@code long} values to the {@link WriteRequest} with a global
* validity flag.
*
- * @param values
- * The {@code long} array sequence.
+ * @param values The {@code long} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder longValues(long[] values) {
@@ -156,13 +144,11 @@
}
/**
- * Adds given {@code long} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code long} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code long} array sequence.
- * @param flags
- * The validity flags for each {@code long} value.
+ * @param values The {@code long} array sequence.
+ * @param flags The validity flags for each {@code long} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder longValues(long[] values, boolean[] flags) {
@@ -174,8 +160,7 @@
* Adds given {@code float} values to the {@link WriteRequest} with a global
* validity flag.
*
- * @param values
- * The {@code float} array sequence.
+ * @param values The {@code float} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder floatValues(float[] values) {
@@ -184,13 +169,11 @@
}
/**
- * Adds given {@code float} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code float} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code float} array sequence.
- * @param flags
- * The validity flags for each {@code float} value.
+ * @param values The {@code float} array sequence.
+ * @param flags The validity flags for each {@code float} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder floatValues(float[] values, boolean[] flags) {
@@ -199,11 +182,10 @@
}
/**
- * Adds given {@code double} values to the {@link WriteRequest} with a
- * global validity flag.
+ * Adds given {@code double} values to the {@link WriteRequest} with a global
+ * validity flag.
*
- * @param values
- * The {@code double} array sequence.
+ * @param values The {@code double} array sequence.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder doubleValues(double[] values) {
@@ -212,13 +194,11 @@
}
/**
- * Adds given {@code double} values to the {@link WriteRequest} with a
- * validity flag for each given value.
+ * Adds given {@code double} values to the {@link WriteRequest} with a validity
+ * flag for each given value.
*
- * @param values
- * The {@code double} array sequence.
- * @param flags
- * The validity flags for each {@code double} value.
+ * @param values The {@code double} array sequence.
+ * @param flags The validity flags for each {@code double} value.
* @return The {@link UnitIndependentBuilder} is returned.
*/
public final UnitIndependentBuilder doubleValues(double[] values, boolean[] flags) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
index 5fb5834..f137a76 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequest.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.massdata;
import java.util.Collections;
@@ -32,17 +31,17 @@
* @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
*/
public final class ReadRequest {
- public enum ValuesMode
- {
+ public enum ValuesMode {
/**
- * MeasuredValues will contain the final values, calculated for non-explicit sequence representations
- * using generation parameters and, if applicable, the raw values.
- * No generation parameters are returned in the resulting MeasuredValues, {@link SequenceRepresentation} will
- * be EXPLICIT.
+ * MeasuredValues will contain the final values, calculated for non-explicit
+ * sequence representations using generation parameters and, if applicable, the
+ * raw values. No generation parameters are returned in the resulting
+ * MeasuredValues, {@link SequenceRepresentation} will be EXPLICIT.
*/
CALCULATED,
/**
- * MeasuredValues will contain the (raw) values and generation parameters as present in the storage.
+ * MeasuredValues will contain the (raw) values and generation parameters as
+ * present in the storage.
*/
STORAGE
}
@@ -58,7 +57,7 @@
private int requestSize = 100_000;
private int startIndex;
-
+
private ValuesMode valuesMode = ValuesMode.CALCULATED;
// ======================================================================
@@ -68,8 +67,7 @@
/**
* Constructor.
*
- * @param readRequest
- * The previous {@link ReadRequest}.
+ * @param readRequest The previous {@link ReadRequest}.
*/
ReadRequest(ReadRequest readRequest) {
this(readRequest.getChannelGroup());
@@ -83,9 +81,8 @@
/**
* Constructor.
*
- * @param channelGroup
- * The {@link ChannelGroup} is the source entity to access
- * measured values.
+ * @param channelGroup The {@link ChannelGroup} is the source entity to access
+ * measured values.
*/
private ReadRequest(ChannelGroup channelGroup) {
this.channelGroup = channelGroup;
@@ -96,9 +93,8 @@
// ======================================================================
/**
- * Creates a new {@link ReadRequestBuilder} with the given
- * {@link ChannelGroup} as the source entity for the requested measured
- * values.
+ * Creates a new {@link ReadRequestBuilder} with the given {@link ChannelGroup}
+ * as the source entity for the requested measured values.
*
* <pre>
* ReadRequest readRequest1 = ReadRequest.create(ChannelGroup).allChannels() // load
@@ -121,8 +117,7 @@
* .get();
* </pre>
*
- * @param channelGroup
- * Used to access measured values.
+ * @param channelGroup Used to access measured values.
* @return Returns the {@link ReadRequestBuilder}.
*/
public static ReadRequestBuilder create(ChannelGroup channelGroup) {
@@ -133,16 +128,16 @@
* Returns the selected {@link Channel}s whose values will be loaded and the
* corresponding {@link Unit} configuration.
*
- * @return The returned {@code Map} is empty, if this request is configured
- * to load values of all related {@code Channel}s.
+ * @return The returned {@code Map} is empty, if this request is configured to
+ * load values of all related {@code Channel}s.
*/
public Map<Channel, Unit> getChannels() {
return Collections.unmodifiableMap(channels);
}
/**
- * Returns the {@link ChannelGroup} which will be used as the source entity
- * to access measured values.
+ * Returns the {@link ChannelGroup} which will be used as the source entity to
+ * access measured values.
*
* @return The measured values source, the {@code ChannelGroup} is returned.
*/
@@ -171,15 +166,15 @@
/**
* Returns the overall index of the measured values within the underlying
- * {@link ChannelGroup}. This index is used while processing this request
- * and means how many values of the values sequences will be skipped.
+ * {@link ChannelGroup}. This index is used while processing this request and
+ * means how many values of the values sequences will be skipped.
*
* @return The overall start index is returned.
*/
public int getStartIndex() {
return startIndex;
}
-
+
/**
* Returns the {link ValuesMode} for measured values retrieval.
*
@@ -197,9 +192,8 @@
* Adds a new {@link Channel} whose measured values have to be loaded. The
* measured values will be retrieved in the unit they were stored.
*
- * @param channel
- * This {@code Channel} has to related to the underlying
- * {@link ChannelGroup}.
+ * @param channel This {@code Channel} has to related to the underlying
+ * {@link ChannelGroup}.
*/
void addChannel(Channel channel) {
addChannel(channel, channel.getUnit());
@@ -210,14 +204,12 @@
* measured values will be retrieved in the given unit.
*
* <p>
- * <b>Note:</b> The processing of this request may fail if it is not
- * possible to convert the values.
+ * <b>Note:</b> The processing of this request may fail if it is not possible to
+ * convert the values.
*
- * @param channel
- * This {@code Channel} has to related to the underlying
- * {@link ChannelGroup}.
- * @param unit
- * {@code Unit} the measured values have to be loaded in.
+ * @param channel This {@code Channel} has to related to the underlying
+ * {@link ChannelGroup}.
+ * @param unit {@code Unit} the measured values have to be loaded in.
*/
void addChannel(Channel channel, Unit unit) {
channels.put(channel, unit);
@@ -237,11 +229,10 @@
* processing this request.
*
* <p>
- * <b>Note:</b> If the request size is zero, then all available measured
- * values will be loaded for each configured {@link Channel}.
+ * <b>Note:</b> If the request size is zero, then all available measured values
+ * will be loaded for each configured {@link Channel}.
*
- * @param requestSize
- * The number of values loaded per {@code Channel}.
+ * @param requestSize The number of values loaded per {@code Channel}.
*/
void setRequestSize(int requestSize) {
this.requestSize = requestSize;
@@ -250,21 +241,18 @@
/**
* Sets the number of values that will be skipped.
*
- * @param startIndex
- * The number of values that will be skipped.
+ * @param startIndex The number of values that will be skipped.
*/
void setStartIndex(int startIndex) {
this.startIndex = startIndex;
}
-
+
/**
* Sets the {@link ValuesMode} for measured values retrieval.
*
- * @param valuesMode
- * The {@link VAluesMode} to set.
+ * @param valuesMode The {@link VAluesMode} to set.
*/
- void setValuesMode(ValuesMode valuesMode)
- {
+ void setValuesMode(ValuesMode valuesMode) {
this.valuesMode = valuesMode;
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
index 980f75b..a1fb3a1 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestBuilder.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.massdata;
import java.util.Arrays;
@@ -44,8 +43,7 @@
/**
* Constructor.
*
- * @param readRequest
- * The {@link ReadRequest} that will be configured.
+ * @param readRequest The {@link ReadRequest} that will be configured.
*/
ReadRequestBuilder(ReadRequest readRequest) {
this.readRequest = readRequest;
@@ -56,8 +54,8 @@
// ======================================================================
/**
- * Configures the {@link ReadRequest} to retrieve measured values of all
- * related {@link Channel}s.
+ * Configures the {@link ReadRequest} to retrieve measured values of all related
+ * {@link Channel}s.
*
* @return This builder is returned.
*/
@@ -70,11 +68,10 @@
* Adds given {@link Channel}s to the underlying {@link ReadRequest}.
*
* <p>
- * <b>Note:</b> {@code Channel}s added with this method will be ignored,
- * once {@link #allChannels()} was called.
+ * <b>Note:</b> {@code Channel}s added with this method will be ignored, once
+ * {@link #allChannels()} was called.
*
- * @param channels
- * The {@code Channel}s whose measured values will be loaded.
+ * @param channels The {@code Channel}s whose measured values will be loaded.
* @return This builder is returned.
*/
public ReadRequestBuilder channels(List<Channel> channels) {
@@ -86,11 +83,10 @@
* Adds given {@link Channel}s to the underlying {@link ReadRequest}.
*
* <p>
- * <b>Note:</b> {@code Channel}s added with this method will be ignored,
- * once {@link #allChannels()} was called.
+ * <b>Note:</b> {@code Channel}s added with this method will be ignored, once
+ * {@link #allChannels()} was called.
*
- * @param channels
- * The {@code Channel}s whose measured values will be loaded.
+ * @param channels The {@code Channel}s whose measured values will be loaded.
* @return This builder is returned.
*/
public ReadRequestBuilder channels(Channel... channels) {
@@ -105,10 +101,8 @@
* <b>Note:</b> {@code Channel} added with this method will be ignored, once
* {@link #allChannels()} was called.
*
- * @param channel
- * The {@code Channel} whose measured values will be loaded.
- * @param unit
- * The unit of the loaded measured values.
+ * @param channel The {@code Channel} whose measured values will be loaded.
+ * @param unit The unit of the loaded measured values.
* @return This builder is returned.
*/
public ReadRequestBuilder channel(Channel channel, Unit unit) {
@@ -120,14 +114,13 @@
* Configures the number of values that will be loaded per {@link Channel}.
*
* <p>
- * <b>Note:</b> If the request size is zero, then all available measured
- * values will be loaded for each configured {@link Channel}.
+ * <b>Note:</b> If the request size is zero, then all available measured values
+ * will be loaded for each configured {@link Channel}.
*
- * @param requestSize
- * The request size.
+ * @param requestSize The request size.
* @return This builder is returned.
- * @throws IllegalArgumentException
- * Thrown if the request size is smaller than 0.
+ * @throws IllegalArgumentException Thrown if the request size is smaller than
+ * 0.
*/
public ReadRequestBuilder requestSize(int requestSize) {
if (requestSize < 0) {
@@ -142,11 +135,9 @@
/**
* Configures the number of values that will be skipped.
*
- * @param startIndex
- * The start index.
+ * @param startIndex The start index.
* @return This builder is returned.
- * @throws IllegalArgumentException
- * Thrown if the start index is smaller than 0.
+ * @throws IllegalArgumentException Thrown if the start index is smaller than 0.
*/
public ReadRequestBuilder startIndex(int startIndex) {
if (startIndex < 0) {
@@ -159,12 +150,11 @@
/**
* Configures the valuesMode.
- * @param valuesMode
- * {@link ValuesMode} to use for the read request.
+ *
+ * @param valuesMode {@link ValuesMode} to use for the read request.
* @return This builder is returned.
*/
- public ReadRequestBuilder valuesMode(ReadRequest.ValuesMode valuesMode)
- {
+ public ReadRequestBuilder valuesMode(ReadRequest.ValuesMode valuesMode) {
readRequest.setValuesMode(valuesMode);
return this;
}
@@ -175,8 +165,8 @@
* ReadRequest}.
*
* <p>
- * <b>Note:</b> Before calling this the {@code Channel}s whose measured
- * values have to be loaded must be configured.
+ * <b>Note:</b> Before calling this the {@code Channel}s whose measured values
+ * have to be loaded must be configured.
*
* @return This builder is returned.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestIterable.java b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestIterable.java
index 00015af..46b8c79 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestIterable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/ReadRequestIterable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -42,8 +41,7 @@
/**
* Constructor.
*
- * @param readRequest
- * The {@link ReadRequest}.
+ * @param readRequest The {@link ReadRequest}.
*/
ReadRequestIterable(ReadRequest readRequest) {
this.readRequest = readRequest;
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/UnitBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/UnitBuilder.java
index cecc1a6..07d8ae5 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/UnitBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/UnitBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -35,9 +34,8 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest}, whose measured value's source
- * {@link Unit} may be defined.
+ * @param writeRequest The {@link WriteRequest}, whose measured value's source
+ * {@link Unit} may be defined.
*/
UnitBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -50,8 +48,7 @@
/**
* Sets a source {@link Unit} for the previously defined measured values.
*
- * @param sourceUnit
- * The source {@code Unit}.
+ * @param sourceUnit The source {@code Unit}.
* @return The {@link WriteRequestFinalizer} is returned.
*/
public WriteRequestFinalizer sourceUnit(Unit sourceUnit) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/UnitIndependentBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/UnitIndependentBuilder.java
index 321cc69..8ca12ce 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/UnitIndependentBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/UnitIndependentBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -51,9 +50,8 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} whose measured values source
- * {@link Unit} may be changed or marked as independent.
+ * @param writeRequest The {@link WriteRequest} whose measured values source
+ * {@link Unit} may be changed or marked as independent.
*/
UnitIndependentBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -66,8 +64,7 @@
/**
* Sets a source {@link Unit} for the previously defined measured values.
*
- * @param sourceUnit
- * The source {@code Unit}.
+ * @param sourceUnit The source {@code Unit}.
* @return The {@link IndependentBuilder} is returned.
*/
public IndependentBuilder sourceUnit(Unit sourceUnit) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
index d440a53..a22c077 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequest.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.massdata;
import java.util.ArrayList;
@@ -60,12 +59,10 @@
/**
* Constructor.
*
- * @param channelGroup
- * The {@link ChannelGroup} for this request.
- * @param channel
- * The {@link Channel} specified mass data will be dedicated to.
- * @param axisType
- * The {@link AxisType} of the written mass data.
+ * @param channelGroup The {@link ChannelGroup} for this request.
+ * @param channel The {@link Channel} specified mass data will be dedicated
+ * to.
+ * @param axisType The {@link AxisType} of the written mass data.
*/
private WriteRequest(ChannelGroup channelGroup, Channel channel, AxisType axisType) {
this.channelGroup = channelGroup;
@@ -78,15 +75,12 @@
// ======================================================================
/**
- * Starts a new {@link WriteRequest} by returning a
- * {@link WriteRequestBuilder}.
+ * Starts a new {@link WriteRequest} by returning a {@link WriteRequestBuilder}.
*
- * @param channelGroup
- * The {@link ChannelGroup} for this request.
- * @param channel
- * The {@link Channel} specified mass data will be dedicated to.
- * @param axisType
- * The {@link AxisType} of the written mass data.
+ * @param channelGroup The {@link ChannelGroup} for this request.
+ * @param channel The {@link Channel} specified mass data will be dedicated
+ * to.
+ * @param axisType The {@link AxisType} of the written mass data.
* @return A {@code WriteRequestBuilder} is returned.
*/
public static WriteRequestBuilder create(ChannelGroup channelGroup, Channel channel, AxisType axisType) {
@@ -130,14 +124,13 @@
}
/**
- * Returns the generation parameters of this request. The length of the
- * returned array depends on the {@link SequenceRepresentation} of this
- * request.
+ * Returns the generation parameters of this request. The length of the returned
+ * array depends on the {@link SequenceRepresentation} of this request.
*
* <p>
- * <b>NOTE:</b> In case of an implicit sequence representation this method
- * will always return an empty array since these generation parameters are
- * correctly typed and stored as measured values.
+ * <b>NOTE:</b> In case of an implicit sequence representation this method will
+ * always return an empty array since these generation parameters are correctly
+ * typed and stored as measured values.
*
* @return If none available, then an empty array is returned.
*/
@@ -148,9 +141,8 @@
/**
* Returns the independent flag of this request.
*
- * @return Returns {@code true} if the measured values do not depend on
- * those of other {@link Channel}s within their common
- * {@link ChannelGroup}.
+ * @return Returns {@code true} if the measured values do not depend on those of
+ * other {@link Channel}s within their common {@link ChannelGroup}.
*/
public boolean isIndependent() {
return independent;
@@ -159,9 +151,8 @@
/**
* Checks whether this request has measured values.
*
- * @return Returns {@code true} if
- * {@link SequenceRepresentation#isExternal()} returns
- * {@code false}.
+ * @return Returns {@code true} if {@link SequenceRepresentation#isExternal()}
+ * returns {@code false}.
* @see #hasExternalComponents()
*/
public boolean hasValues() {
@@ -172,8 +163,7 @@
* Returns the stored measured values.
*
* @return The measured values are returned.
- * @throws IllegalStateException
- * Thrown if values are not available.
+ * @throws IllegalStateException Thrown if values are not available.
*/
public Object getValues() {
if (hasValues()) {
@@ -184,11 +174,11 @@
}
/**
- * Checks whether this request has measured values, stored in externally
- * linked files.
+ * Checks whether this request has measured values, stored in externally linked
+ * files.
*
- * @return Returns {@code true} if
- * {@link SequenceRepresentation#isExternal()} returns {@code true}.
+ * @return Returns {@code true} if {@link SequenceRepresentation#isExternal()}
+ * returns {@code true}.
* @see #hasValues()
*/
public boolean hasExternalComponents() {
@@ -200,8 +190,7 @@
* referenced files.
*
* @return Returned {@code List} is unmodifiable.
- * @throws IllegalStateException
- * Thrown if configurations are not available.
+ * @throws IllegalStateException Thrown if configurations are not available.
*/
public List<ExternalComponent> getExternalComponents() {
if (!hasExternalComponents()) {
@@ -224,9 +213,9 @@
* Returns the calculated {@link ScalarType} which reflects the final
* {@code ScalarType} of the generated measured value sequence. If
* {@link #getGenerationParameters()} returns a not empty array and
- * {@link #getRawScalarType()} is an integer type (byte, short, int, long),
- * then the returned {@code ScalarType} is bumped to the next suitable
- * floating point type as listed below:
+ * {@link #getRawScalarType()} is an integer type (byte, short, int, long), then
+ * the returned {@code ScalarType} is bumped to the next suitable floating point
+ * type as listed below:
*
* <ul>
* <li>{@link ScalarType#BYTE} -> {@link ScalarType#FLOAT}</li>
@@ -246,9 +235,9 @@
}
/**
- * Checks whether all measured values within the whole sequence are valid.
- * If this method returns {@code true}, then {@link #getFlags()} will return
- * an empty array.
+ * Checks whether all measured values within the whole sequence are valid. If
+ * this method returns {@code true}, then {@link #getFlags()} will return an
+ * empty array.
*
* @return Returns {@code true} if all measured values are valid.
* @see #getFlags()
@@ -259,9 +248,9 @@
/**
* Returns the validity flags sequence for the stored measured values. If
- * {@link #areAllValid()} returns {@code false} this method will return an
- * array with the same length as the measured values sequence, where each
- * flag indicates whether the corresponding measured value is valid or not.
+ * {@link #areAllValid()} returns {@code false} this method will return an array
+ * with the same length as the measured values sequence, where each flag
+ * indicates whether the corresponding measured value is valid or not.
*
* @return The validity flags sequence is returned.
* @see #allValid
@@ -277,8 +266,7 @@
/**
* Sets the {@link SequenceRepresentation} for this request.
*
- * @param sequenceRepresentation
- * The {@link SequenceRepresentation}.
+ * @param sequenceRepresentation The {@link SequenceRepresentation}.
*/
void setSequenceRepresentation(SequenceRepresentation sequenceRepresentation) {
this.sequenceRepresentation = sequenceRepresentation;
@@ -287,8 +275,7 @@
/**
* Sets generation parameters for this request.
*
- * @param generationParameters
- * The generation parameters.
+ * @param generationParameters The generation parameters.
*/
void setGenerationParameters(double[] generationParameters) {
this.generationParameters = generationParameters.clone();
@@ -300,24 +287,22 @@
void setIndependent() {
independent = true;
}
-
+
/**
* Sets the independent flag for this request to the value specified.
*
- * @param independent
- * The independent flag.
+ * @param independent The independent flag.
*/
void setIndependent(boolean independent) {
this.independent = independent;
}
/**
- * Triggers an adjustment of the generation parameters and modification of
- * the {@link SequenceRepresentation} of this request to match the
- * {@link Channel}s default {@link Unit}.
+ * Triggers an adjustment of the generation parameters and modification of the
+ * {@link SequenceRepresentation} of this request to match the {@link Channel}s
+ * default {@link Unit}.
*
- * @param sourceUnit
- * The {@link Unit} of the measured values.
+ * @param sourceUnit The {@link Unit} of the measured values.
*/
void setSourceUnit(Unit sourceUnit) {
throw new UnsupportedOperationException("Conversion between units is not implemented yet.");
@@ -326,8 +311,7 @@
/**
* Sets the raw {@link ScalarType} for this request.
*
- * @param rawScalarType
- * The {@link ScalarType}.
+ * @param rawScalarType The {@link ScalarType}.
*/
void setRawScalarType(ScalarType rawScalarType) {
this.rawScalarType = rawScalarType;
@@ -337,10 +321,9 @@
* Sets the measured values sequence where each value in the sequence is
* expected to be valid.
*
- * @param values
- * The measured value sequence.
- * @throws IllegalStateException
- * Thrown if {@link #hasValues()} returns {@code false}.
+ * @param values The measured value sequence.
+ * @throws IllegalStateException Thrown if {@link #hasValues()} returns
+ * {@code false}.
*/
void setValues(Object values) {
if (hasValues()) {
@@ -352,15 +335,13 @@
}
/**
- * Sets the measured values sequence where each value's validity is
- * specified in the given flags array.
+ * Sets the measured values sequence where each value's validity is specified in
+ * the given flags array.
*
- * @param values
- * The measured value sequence.
- * @param flags
- * The validity flag sequence.
- * @throws IllegalStateException
- * Thrown if {@link #hasValues()} returns {@code false}.
+ * @param values The measured value sequence.
+ * @param flags The validity flag sequence.
+ * @throws IllegalStateException Thrown if {@link #hasValues()} returns
+ * {@code false}.
*/
void setValues(Object values, boolean[] flags) {
if (hasValues()) {
@@ -372,14 +353,11 @@
}
/**
- * Adds a configuration for measured values stored in externally linked
- * files.
+ * Adds a configuration for measured values stored in externally linked files.
*
- * @param externalComponent
- * The new configuration.
- * @throws IllegalStateException
- * Thrown if {@link #hasExternalComponents()} returns
- * {@code false}.
+ * @param externalComponent The new configuration.
+ * @throws IllegalStateException Thrown if {@link #hasExternalComponents()}
+ * returns {@code false}.
*/
void addExternalComponent(ExternalComponent externalComponent) {
if (hasExternalComponents()) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestBuilder.java b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestBuilder.java
index f77ac8a..13f5dff 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestBuilder.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestBuilder.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -34,8 +33,7 @@
/**
* Constructor.
*
- * @param writeRequest
- * The {@link WriteRequest} which will be configured.
+ * @param writeRequest The {@link WriteRequest} which will be configured.
*/
WriteRequestBuilder(WriteRequest writeRequest) {
super(writeRequest);
@@ -58,8 +56,8 @@
}
/**
- * Configures the {@link WriteRequest} to create an implicit constant
- * sequence of measured values. An implicit sequence allows only numerical
+ * Configures the {@link WriteRequest} to create an implicit constant sequence
+ * of measured values. An implicit sequence allows only numerical
* {@link ScalarType}s as listed below:
*
* <ul>
@@ -74,14 +72,12 @@
* <p>
* <b>Note:</b> Given offset will be cast to an assignment compatible type.
*
- * @param scalarType
- * The {@code ScalarType} of each single measured value in the
- * sequence.
- * @param offset
- * The constant value.
+ * @param scalarType The {@code ScalarType} of each single measured value in the
+ * sequence.
+ * @param offset The constant value.
* @return An {@link UnitBuilder} is returned.
- * @throws IllegalArgumentException
- * Thrown if given {@code ScalarType} is not supported.
+ * @throws IllegalArgumentException Thrown if given {@code ScalarType} is not
+ * supported.
* @see SequenceRepresentation#IMPLICIT_CONSTANT
*/
public UnitBuilder implicitConstant(ScalarType scalarType, double offset) {
@@ -109,8 +105,8 @@
}
/**
- * Configures the {@link WriteRequest} to create an implicit linear sequence
- * of measured values. An implicit sequence allows only numerical
+ * Configures the {@link WriteRequest} to create an implicit linear sequence of
+ * measured values. An implicit sequence allows only numerical
* {@link ScalarType}s as listed below:
*
* <ul>
@@ -126,16 +122,13 @@
* <b>Note:</b> Given start and increment will be cast to an assignment
* compatible type.
*
- * @param scalarType
- * The {@code ScalarType} of each single measured value in the
- * sequence.
- * @param start
- * The start value of the line.
- * @param increment
- * The gradient of the line.
+ * @param scalarType The {@code ScalarType} of each single measured value in the
+ * sequence.
+ * @param start The start value of the line.
+ * @param increment The gradient of the line.
* @return An {@link UnitIndependentBuilder} is returned.
- * @throws IllegalArgumentException
- * Thrown if given {@code ScalarType} is not supported.
+ * @throws IllegalArgumentException Thrown if given {@code ScalarType} is not
+ * supported.
* @see SequenceRepresentation#IMPLICIT_LINEAR
*/
public UnitIndependentBuilder implicitLinear(ScalarType scalarType, double start, double increment) {
@@ -180,18 +173,14 @@
* <b>Note:</b> Given start, increment and valuesPerSaw will be cast to an
* assignment compatible type.
*
- * @param scalarType
- * The {@code ScalarType} of each single measured value in the
- * sequence.
- * @param start
- * The start value of each saw cycle.
- * @param increment
- * The increment.
- * @param valuesPerSaw
- * The number of values per saw.
+ * @param scalarType The {@code ScalarType} of each single measured value in
+ * the sequence.
+ * @param start The start value of each saw cycle.
+ * @param increment The increment.
+ * @param valuesPerSaw The number of values per saw.
* @return An {@link UnitBuilder} is returned.
- * @throws IllegalArgumentException
- * Thrown if given {@code ScalarType} is not supported.
+ * @throws IllegalArgumentException Thrown if given {@code ScalarType} is not
+ * supported.
* @see SequenceRepresentation#IMPLICIT_SAW
*/
public UnitBuilder implicitSaw(ScalarType scalarType, double start, double increment, double valuesPerSaw) {
@@ -224,10 +213,8 @@
* Configures the {@link WriteRequest} to create a raw linear sequence of
* measured values.
*
- * @param offset
- * The offset for each value.
- * @param factor
- * The factor for each value.
+ * @param offset The offset for each value.
+ * @param factor The factor for each value.
* @return A {@link ComplexNumericalValuesBuilder} is returned.
* @see SequenceRepresentation#RAW_LINEAR
*/
@@ -238,15 +225,13 @@
}
/**
- * Configures the {@link WriteRequest} to create a raw polynomial sequence
- * of measured values.
+ * Configures the {@link WriteRequest} to create a raw polynomial sequence of
+ * measured values.
*
- * @param coefficients
- * At least 2 coefficients must be provided.
+ * @param coefficients At least 2 coefficients must be provided.
* @return A {@link ComplexNumericalValuesBuilder} is returned.
- * @throws IllegalArgumentException
- * Thrown if coefficients are missing or their length is less
- * than 2.
+ * @throws IllegalArgumentException Thrown if coefficients are missing or their
+ * length is less than 2.
* @see SequenceRepresentation#RAW_POLYNOMIAL
*/
public ComplexNumericalValuesBuilder rawPolynomial(double... coefficients) {
@@ -272,12 +257,9 @@
* Configures the {@link WriteRequest} to create a raw linear calibrated
* sequence of measured values.
*
- * @param offset
- * The offset for each value.
- * @param factor
- * The factor for each value.
- * @param calibration
- * The calibration factor.
+ * @param offset The offset for each value.
+ * @param factor The factor for each value.
+ * @param calibration The calibration factor.
* @return A {@link ComplexNumericalValuesBuilder} is returned.
* @see SequenceRepresentation#RAW_LINEAR_CALIBRATED
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestFinalizer.java b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestFinalizer.java
index 19d2fea..2452766 100644
--- a/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestFinalizer.java
+++ b/src/main/java/org/eclipse/mdm/api/base/massdata/WriteRequestFinalizer.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.massdata;
@@ -38,8 +37,7 @@
/**
* Constructor.
*
- * @param writeRequest
- * The configured {@link WriteRequest}.
+ * @param writeRequest The configured {@link WriteRequest}.
*/
WriteRequestFinalizer(WriteRequest writeRequest) {
this.writeRequest = writeRequest;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/AxisType.java b/src/main/java/org/eclipse/mdm/api/base/model/AxisType.java
index d2e0c1f..6a8e67e 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/AxisType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/AxisType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/BaseEntity.java b/src/main/java/org/eclipse/mdm/api/base/model/BaseEntity.java
index b70249b..a9eeb8d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/BaseEntity.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/BaseEntity.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -46,8 +45,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
protected BaseEntity(Core core) {
this.core = core;
@@ -126,8 +124,7 @@
/**
* Convenience method to extract {@link Core} of given {@link Entity}.
*
- * @param entity
- * The {@code Entity} whose {@code Core} is required.
+ * @param entity The {@code Entity} whose {@code Core} is required.
* @return The {@code Core} is returned.
*/
protected static Core getCore(Entity entity) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/BaseEntityFactory.java b/src/main/java/org/eclipse/mdm/api/base/model/BaseEntityFactory.java
index 95367a8..73d7f68 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/BaseEntityFactory.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/BaseEntityFactory.java
@@ -1,626 +1,564 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.model;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Optional;
-
-import org.eclipse.mdm.api.base.adapter.ChildrenStore;
-import org.eclipse.mdm.api.base.adapter.Core;
-import org.eclipse.mdm.api.base.adapter.EntityStore;
-
-/**
- * Implementation of an abstract entity factory which creates new entities.
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
- */
-public abstract class BaseEntityFactory {
-
- // ======================================================================
- // Public methods
- // ======================================================================
-
- /**
- * Creates a new {@link Channel}. The name of the returned {@code Channel}
- * is retrieved from given {@link Quantity}.
- *
- * @param measurement
- * The parent {@link Measurement}.
- * @param quantity
- * The {@code Quantity} is used for default initialization.
- * @return The created {@code Channel} is returned.
- */
- public Channel createChannel(Measurement measurement, Quantity quantity) {
- return createChannel(quantity.getDefaultChannelName(), measurement, quantity);
- }
-
- /**
- * Creates a new {@link Channel}.
- *
- * @param name
- * Name of the created {@code Channel}.
- * @param measurement
- * The parent {@link Measurement}.
- * @param quantity
- * The {@code Quantity} is used for default initialization.
- * @return The created {@code Channel} is returned.
- */
- public Channel createChannel(String name, Measurement measurement, Quantity quantity) {
- Channel channel = new Channel(createCore(Channel.class));
-
- // relations
- getCore(channel).getPermanentStore().set(measurement);
- getCore(measurement).getChildrenStore().add(channel);
- getCore(channel).getMutableStore().set(quantity.getDefaultUnit());
- getCore(channel).getMutableStore().set(quantity);
-
- // properties
- channel.setName(name);
- channel.setDescription(quantity.getDescription());
- channel.setInterpolation(Interpolation.NONE);
- channel.setScalarType(quantity.getDefaultScalarType());
- channel.setRank(quantity.getDefaultRank());
- channel.setTypeSize(quantity.getDefaultTypeSize());
-
- return channel;
- }
-
- /**
- * Creates a new {@link ChannelGroup}.
- *
- * @param name
- * Name of the created {@code ChannelGroup}.
- * @param numberOfValues
- * The number of values per each related {@link Channel}.
- * @param measurement
- * The parent {@link Measurement}.
- * @return The created {@code ChannelGroup} is returned.
- * @throws IllegalArgumentException
- * Thrown if numberOfValues is negative.
- */
- public ChannelGroup createChannelGroup(String name, int numberOfValues, Measurement measurement) {
- if (numberOfValues < 0) {
- throw new IllegalArgumentException("Number of values must be equal or greater than 0.");
- }
-
- ChannelGroup channelGroup = new ChannelGroup(createCore(ChannelGroup.class));
-
- // relations
- getCore(channelGroup).getPermanentStore().set(measurement);
- getCore(measurement).getChildrenStore().add(channelGroup);
-
- // properties
- channelGroup.setName(name);
- channelGroup.setNumberOfValues(Integer.valueOf(numberOfValues));
-
- return channelGroup;
- }
-
- /**
- * Creates a new {@link Measurement}.
- *
- * @param name
- * Name of the created {@code Measurement}.
- * @param testStep
- * The parent {@link TestStep}.
- * @param contextRoots
- * {@link ContextRoot}s containing the descriptive data.
- * @return The created {@code Measurement} is returned.
- */
- public Measurement createMeasurement(String name, TestStep testStep, ContextRoot... contextRoots) {
- Measurement measurement = new Measurement(createCore(Measurement.class));
-
- // relations
- getCore(measurement).getPermanentStore().set(testStep);
- getCore(testStep).getChildrenStore().add(measurement);
- for (ContextRoot contextRoot : contextRoots) {
- getCore(measurement).getMutableStore().set(contextRoot, contextRoot.getContextType());
- }
-
- // properties
- measurement.setName(name);
- measurement.setDateCreated(LocalDateTime.now());
-
- return measurement;
- }
-
- /**
- * Creates a new {@link Parameter} with initialized with given value.
- *
- * @param name
- * Name of the created {@code Parameter}.
- * @param value
- * The value of the created {@code Parameter}.
- * @param unit
- * An optionally related {@link Unit}.
- * @param parameterSet
- * The parent {@link ParameterSet}.
- * @return The created {@code Parameter} is returned.
- * @throws IllegalArgumentException
- * Thrown if the {@code ParameterSet} already contains a
- * {@code Parameter} with given name.
- * @see Parameter#setObjectValue(Object, Unit)
- */
- public Parameter createParameter(String name, Object value, Unit unit, ParameterSet parameterSet) {
- if (parameterSet.getParameter(name).isPresent()) {
- throw new IllegalArgumentException("Parameter with name '" + name + "' already exists.");
- }
-
- Parameter parameter = new Parameter(createCore(Parameter.class));
-
- // relations
- getCore(parameter).getPermanentStore().set(parameterSet);
- getCore(parameterSet).getChildrenStore().add(parameter);
-
- // properties
- parameter.setName(name);
- parameter.setObjectValue(value, unit);
-
- return parameter;
- }
-
- /**
- * Creates a new {@link ParameterSet} for given {@link Measurement}.
- *
- * @param name
- * Name of the created {@code ParameterSet}.
- * @param version
- * Version of the created {@code ParameterSet}.
- * @param measurement
- * The owning {@code Measurement}.
- * @return The created {@code ParameterSet} is returned.
- */
- public ParameterSet createParameterSet(String name, String version, Measurement measurement) {
- ParameterSet parameterSet = new ParameterSet(createCore(ParameterSet.class));
-
- // relations
- getCore(parameterSet).getPermanentStore().set(measurement);
- getCore(measurement).getChildrenStore().add(parameterSet);
-
- // properties
- parameterSet.setName(name);
- parameterSet.setVersion(version);
-
- return parameterSet;
- }
-
- /**
- * Creates a new {@link ParameterSet} for given {@link Channel}.
- *
- * @param name
- * Name of the created {@code ParameterSet}.
- * @param version
- * Version of the created {@code ParameterSet}.
- * @param channel
- * The owning {@code Channel}.
- * @return The created {@code ParameterSet} is returned.
- */
- public ParameterSet createParameterSet(String name, String version, Channel channel) {
- ParameterSet parameterSet = new ParameterSet(createCore(ParameterSet.class));
-
- // relations
- getCore(parameterSet).getPermanentStore().set(channel);
- getCore(channel).getChildrenStore().add(parameterSet);
-
- // properties
- parameterSet.setName(name);
- parameterSet.setVersion(version);
-
- return parameterSet;
- }
-
- /**
- * Creates a new {@link PhysicalDimension}.
- *
- * @param name
- * Name of the created {@code PhysicalDimension}.
- * @return The created {@code PhysicalDimension} is returned.
- */
- public PhysicalDimension createPhysicalDimension(String name) {
- PhysicalDimension physicalDimension = new PhysicalDimension(createCore(PhysicalDimension.class));
-
- // properties
- physicalDimension.setName(name);
- physicalDimension.setLength(Integer.valueOf(0));
- physicalDimension.setMass(Integer.valueOf(0));
- physicalDimension.setTime(Integer.valueOf(0));
- physicalDimension.setTemperature(Integer.valueOf(0));
- physicalDimension.setCurrent(Integer.valueOf(0));
- physicalDimension.setMolarAmount(Integer.valueOf(0));
- physicalDimension.setLuminousIntensity(Integer.valueOf(0));
- physicalDimension.setAngle(Integer.valueOf(0));
-
- return physicalDimension;
- }
-
- /**
- * Creates a new {@link Quantity}.
- *
- * @param name
- * Name of the created {@code Quantity}.
- * @param defaultUnit
- * The default {@link Unit}.
- * @return The created {@code Quantity} is returned.
- */
- public Quantity createQuantity(String name, Unit defaultUnit) {
- Quantity quantity = new Quantity(createCore(Quantity.class));
-
- // relations
- getCore(quantity).getMutableStore().set(defaultUnit);
-
- // properties
- quantity.setName(name);
- quantity.setDateCreated(LocalDateTime.now());
- quantity.setDefaultRank(Integer.valueOf(1));
- quantity.setDefaultDimension(new int[] { 0 });
- quantity.setDefaultTypeSize(Integer.valueOf(1));
- quantity.setDefaultChannelName(name);
- quantity.setDefaultScalarType(ScalarType.FLOAT);
-
- quantity.getValue("Version").set("1");
- quantity.getValue("ValidFlag").set(VersionState.VALID);
-
- return quantity;
- }
-
- /**
- * Creates a new {@link Test} with a reference to the logged in
- * {@link User}, if there is one.
- *
- * @param name
- * Name of the created {@code Test}.
- * @return The created {@code Test} is returned.
- */
- public Test createTest(String name) {
- Test test = new Test(createCore(Test.class));
-
- // relations
- Optional<User> responsiblePerson = getLoggedInUser();
- if (responsiblePerson.isPresent()) {
- // may be null if user entities are not available
- getCore(test).getMutableStore().set(responsiblePerson.get());
- }
-
- // properties
- test.setName(name);
- test.setDateCreated(LocalDateTime.now());
-
- return test;
- }
-
- /**
- * Creates a new {@link TestStep}.
- *
- * @param name
- * Name of the created {@code TestStep}.
- * @param test
- * The parent {@link Test}.
- * @return The created {@code TestStep} is returned.
- */
- public TestStep createTestStep(String name, Test test) {
- TestStep testStep = new TestStep(createCore(TestStep.class));
-
- // relations
- getCore(testStep).getPermanentStore().set(test);
- getCore(test).getChildrenStore().add(testStep);
-
- // properties
- testStep.setName(name);
- testStep.setDateCreated(LocalDateTime.now());
- testStep.setOptional(Boolean.TRUE);
-
- if (test.getID() != null && test.getID().length() > 0) {
- // highest sort index in use will be queried before written
- testStep.setSortIndex(Integer.valueOf(-1));
- } else {
- testStep.setSortIndex(nextIndex(getCore(test).getChildrenStore().get(TestStep.class)));
- }
-
- return testStep;
- }
-
- /**
- * Creates a new {@link Unit}.
- *
- * @param name
- * Name of the created {@code Unit}.
- * @param physicalDimension
- * The {@link PhysicalDimension}.
- * @return The created {@code Unit} is returned.
- */
- public Unit createUnit(String name, PhysicalDimension physicalDimension) {
- Unit unit = new Unit(createCore(Unit.class));
-
- // relations
- getCore(unit).getMutableStore().set(physicalDimension);
-
- // properties
- unit.setName(name);
- unit.setOffset(Double.valueOf(0D));
- unit.setFactor(Double.valueOf(1D));
-
- return unit;
- }
-
- /**
- * Creates a new {@link User}.
- *
- * @param name
- * Name of the created {@code User}.
- * @param givenName
- * Given name of the created {@code User}.
- * @param surname
- * Surname of the created {@code User}.
- * @return The created {@code User} is returned.
- */
- public User createUser(String name, String givenName, String surname) {
- User user = new User(createCore(User.class));
-
- // properties
- user.setName(name);
- user.setGivenName(givenName);
- user.setSurname(surname);
-
- return user;
- }
-
- // ======================================================================
- // Protected methods
- // ======================================================================
-
- /**
- * Creates a new {@link ContextRoot}.
- *
- * @param name
- * Name of the created {@code ContextRoot}.
- * @param contextType
- * {@link ContextType} of the created {@code ContextRoot}.
- * @return The created {@code ContextRoot} is returned.
- */
- protected ContextRoot createContextRoot(String name, ContextType contextType) {
- ContextRoot contextRoot = new ContextRoot(createCore(ContextRoot.class, contextType));
-
- // properties
- contextRoot.setName(name);
- contextRoot.setVersion(String.valueOf(0));
-
- return contextRoot;
- }
-
- /**
- * Creates a new {@link ContextComponent}.
- *
- * @param name
- * Name of the created {@code ContextComponent}.
- * @param contextRoot
- * The parent {@link ContextRoot}.
- * @return The created {@code ContextComponent} is returned.
- */
- protected ContextComponent createContextComponent(String name, ContextRoot contextRoot) {
- ContextComponent contextComponent = new ContextComponent(createCore(name, ContextComponent.class));
-
- // relations
- getCore(contextComponent).getPermanentStore().set(contextRoot);
- getCore(contextRoot).getChildrenStore().add(contextComponent);
-
- // properties
- contextComponent.setName(name);
-
- return contextComponent;
- }
-
- /**
- * Creates a new {@link ContextSensor}.
- *
- * @param name
- * Name of the created {@code ContextSensor}.
- * @param contextComponent
- * The parent {@link ContextComponent}.
- * @return The created {@code ContextSensor} is returned.
- */
- protected ContextSensor createContextSensor(String name, ContextComponent contextComponent) {
- ContextSensor contextSensor = new ContextSensor(createCore(name, ContextSensor.class));
- // relations
- getCore(contextSensor).getPermanentStore().set(contextComponent);
- getCore(contextComponent).getChildrenStore().add(contextSensor);
-
- // properties
- contextSensor.setName(name);
-
- return contextSensor;
- }
-
- /**
- * Returns the next usable sort index for given {@code List} of
- * {@link Sortable}s.
- *
- * @param sortables
- * The {@code Sortable} whose max sort index will be searched.
- * @return {@code 1} is returned if given {@code List} is empty, otherwise
- * the max sort index increased by 1 is returned.
- */
- protected static final Integer nextIndex(List<? extends Sortable> sortables) {
- Optional<Integer> maxIndex = sortables.stream().max(Sortable.COMPARATOR).map(Sortable::getSortIndex);
- return Integer.valueOf(maxIndex.isPresent() ? maxIndex.get().intValue() + 1 : 1);
- }
-
- /**
- * Returns the {@link ChildrenStore} for given {@link BaseEntity}.
- * Please be aware that the contents of this store is subject
- * to the adapter creating it. It is up to the adapter to decide
- * which related entities are included.
- * As there are adapter specific details to the contents of the store it
- * should be protected from external access.
- * Therefore by declaring this method protected, the
- * related functionality is hidden from other classes since the only
- * classes which can access them (outside this package) are derivatives of
- * BaseEntityFactory, and it is through such derivatives that BaseEntity's
- * Stores should be accessed elsewhere if needed.
- *
- * @param entity
- * The {@code BaseEntity} whose {@code ChildrenStore} will be
- * returned.
- * @return The {@code ChildrenStore} is returned.
- */
- protected static ChildrenStore getChildrenStore(BaseEntity entity) {
- return getCore(entity).getChildrenStore();
- }
-
- /**
- * Returns the mutable {@link EntityStore} for given {@link BaseEntity}.
- * Please be aware that the contents of this store is subject
- * to the adapter creating it. It is up to the adapter to decide
- * which related entities are included.
- * As there are adapter specific details to the contents of the store it
- * should be protected from external access.
- * Therefore by declaring this method protected, the
- * related functionality is hidden from other classes since the only
- * classes which can access them (outside this package) are derivatives of
- * BaseEntityFactory, and it is through such derivatives that BaseEntity's
- * Stores should be accessed elsewhere if needed.
- *
- *
- * @param entity
- * The {@code BaseEntity} whose {@code ChildrenStore} will be
- * returned.
- * @return The mutable {@code EntityStore} is returned.
- */
- protected static EntityStore getMutableStore(BaseEntity entity) {
- return getCore(entity).getMutableStore();
- }
-
- /**
- * Returns the permanent {@link EntityStore} for given {@link BaseEntity}.
- * Please be aware that the contents of this store is subject
- * to the adapter creating it. It is up to the adapter to decide
- * which related entities are included.
- * As there are adapter specific details to the contents of the store it
- * should be protected from external access.
- * Therefore by declaring this method protected, the
- * related functionality is hidden from other classes since the only
- * classes which can access them (outside this package) are derivatives of
- * BaseEntityFactory, and it is through such derivatives that BaseEntity's
- * Stores should be accessed elsewhere if needed.
- *
- * @param entity
- * The {@code BaseEntity} whose {@code ChildrenStore} will be
- * returned.
- * @return The permanent {@code EntityStore} is returned.
- */
- protected static EntityStore getPermanentStore(BaseEntity entity) {
- return getCore(entity).getPermanentStore();
- }
-
- /**
- * Returns {@link Core} of given {@link Entity}. Uses protected method from
- * BaseEntity, which is accessible here as BaseEntity resides in the same
- * package as BaseEntityFactory. By declaring this method protected, the
- * Core-related functionality is hidden from other classes since the only
- * classes which can access them (outside this package) are derivatives of
- * BaseEntityFactory, and it is through such derivatives that a BaseEntity's
- * Core should be accessed elsewhere if needed.
- *
- * @param entity
- * The {@code BaseEntity} whose {@code Core} is required.
- * @return The {@code Core} is returned.
- */
- protected static final Core getCore(BaseEntity entity) {
- return entity.getCore();
- }
-
- /**
- * Create an instance of {@link BaseEntity} (or derivative) with core as the
- * instance's {@link Core}. By declaring this method protected, the Core-related
- * functionality is hidden from other classes since the only classes which can
- * access them (outside this package) are derivatives of BaseEntityFactory, and
- * it is through such derivatives that a BaseEntity's Core should be accessed
- * elsewhere if needed.
- * <br> <br>
- * This method accesses the (usually protected) Constructor(Core) of clazz, so
- * this method should be overridden in a derived class and call
- * super.createBaseEntity() if that constructor is invisible from the derived
- * class.
- *
- * @param clazz
- * The class to instantiate, must extend {@link BaseEntity}.
- * @param core
- * The {@link Core} to use for the newly created instance.
- * @return The newly created instance.
- */
- protected <T extends BaseEntity> T createBaseEntity(Class<T> clazz, Core core) {
- try {
- Constructor<T> constructor = clazz.getDeclaredConstructor(Core.class);
- try {
- return constructor.newInstance(core);
- } catch (IllegalAccessException exc) {
- throw new IllegalStateException("Cannot access Constructor(Core) of class '" + clazz.getName() + "'!");
- }
- } catch (NoSuchMethodException | InvocationTargetException | InstantiationException exc) {
- throw new IllegalStateException(exc.getMessage(), exc);
- }
- }
-
- /**
- * Returns the {@link User} which is bound to the current session.
- *
- * @return {@code Optional} is empty if {@code User} entities do not exist.
- */
- protected abstract Optional<User> getLoggedInUser();
-
- /**
- * Returns a new {@link Core} for given entity class.
- *
- * @param <T>
- * The entity class type.
- * @param entityClass
- * The entity class.
- * @return A new {@code Core} instance is returned.
- */
- protected abstract <T extends Entity> Core createCore(Class<T> entityClass);
-
- /**
- * Returns a new {@link Core} for given entity class and
- * {@link ContextType}.
- *
- * @param <T>
- * The entity class type.
- * @param entityClass
- * The entity class.
- * @param contextType
- * The {@code ContextType}.
- * @return A new {@code Core} instance is returned.
- */
- protected abstract <T extends Entity> Core createCore(Class<T> entityClass, ContextType contextType);
-
- /**
- * Returns a new {@link Core} for given entity class and type name.
- *
- * @param <T>
- * The entity class type.
- * @param name
- * Name of the entity type.
- * @param entityClass
- * The entity class.
- * @return A new {@code Core} instance is returned.
- */
- protected abstract <T extends Entity> Core createCore(String name, Class<T> entityClass);
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Optional;
+
+import org.eclipse.mdm.api.base.adapter.ChildrenStore;
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.adapter.EntityStore;
+
+/**
+ * Implementation of an abstract entity factory which creates new entities.
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
+ */
+public abstract class BaseEntityFactory {
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ /**
+ * Creates a new {@link Channel}. The name of the returned {@code Channel} is
+ * retrieved from given {@link Quantity}.
+ *
+ * @param measurement The parent {@link Measurement}.
+ * @param quantity The {@code Quantity} is used for default initialization.
+ * @return The created {@code Channel} is returned.
+ */
+ public Channel createChannel(Measurement measurement, Quantity quantity) {
+ return createChannel(quantity.getDefaultChannelName(), measurement, quantity);
+ }
+
+ /**
+ * Creates a new {@link Channel}.
+ *
+ * @param name Name of the created {@code Channel}.
+ * @param measurement The parent {@link Measurement}.
+ * @param quantity The {@code Quantity} is used for default initialization.
+ * @return The created {@code Channel} is returned.
+ */
+ public Channel createChannel(String name, Measurement measurement, Quantity quantity) {
+ Channel channel = new Channel(createCore(Channel.class));
+
+ // relations
+ getCore(channel).getPermanentStore().set(measurement);
+ getCore(measurement).getChildrenStore().add(channel);
+ getCore(channel).getMutableStore().set(quantity.getDefaultUnit());
+ getCore(channel).getMutableStore().set(quantity);
+
+ // properties
+ channel.setName(name);
+ channel.setDescription(quantity.getDescription());
+ channel.setInterpolation(Interpolation.NONE);
+ channel.setScalarType(quantity.getDefaultScalarType());
+ channel.setRank(quantity.getDefaultRank());
+ channel.setTypeSize(quantity.getDefaultTypeSize());
+
+ return channel;
+ }
+
+ /**
+ * Creates a new {@link ChannelGroup}.
+ *
+ * @param name Name of the created {@code ChannelGroup}.
+ * @param numberOfValues The number of values per each related {@link Channel}.
+ * @param measurement The parent {@link Measurement}.
+ * @return The created {@code ChannelGroup} is returned.
+ * @throws IllegalArgumentException Thrown if numberOfValues is negative.
+ */
+ public ChannelGroup createChannelGroup(String name, int numberOfValues, Measurement measurement) {
+ if (numberOfValues < 0) {
+ throw new IllegalArgumentException("Number of values must be equal or greater than 0.");
+ }
+
+ ChannelGroup channelGroup = new ChannelGroup(createCore(ChannelGroup.class));
+
+ // relations
+ getCore(channelGroup).getPermanentStore().set(measurement);
+ getCore(measurement).getChildrenStore().add(channelGroup);
+
+ // properties
+ channelGroup.setName(name);
+ channelGroup.setNumberOfValues(Integer.valueOf(numberOfValues));
+
+ return channelGroup;
+ }
+
+ /**
+ * Creates a new {@link Measurement}.
+ *
+ * @param name Name of the created {@code Measurement}.
+ * @param testStep The parent {@link TestStep}.
+ * @param contextRoots {@link ContextRoot}s containing the descriptive data.
+ * @return The created {@code Measurement} is returned.
+ */
+ public Measurement createMeasurement(String name, TestStep testStep, ContextRoot... contextRoots) {
+ Measurement measurement = new Measurement(createCore(Measurement.class));
+
+ // relations
+ getCore(measurement).getPermanentStore().set(testStep);
+ getCore(testStep).getChildrenStore().add(measurement);
+ for (ContextRoot contextRoot : contextRoots) {
+ getCore(measurement).getMutableStore().set(contextRoot, contextRoot.getContextType());
+ }
+
+ // properties
+ measurement.setName(name);
+ measurement.setDateCreated(LocalDateTime.now());
+
+ return measurement;
+ }
+
+ /**
+ * Creates a new {@link Parameter} with initialized with given value.
+ *
+ * @param name Name of the created {@code Parameter}.
+ * @param value The value of the created {@code Parameter}.
+ * @param unit An optionally related {@link Unit}.
+ * @param parameterSet The parent {@link ParameterSet}.
+ * @return The created {@code Parameter} is returned.
+ * @throws IllegalArgumentException Thrown if the {@code ParameterSet} already
+ * contains a {@code Parameter} with given
+ * name.
+ * @see Parameter#setObjectValue(Object, Unit)
+ */
+ public Parameter createParameter(String name, Object value, Unit unit, ParameterSet parameterSet) {
+ if (parameterSet.getParameter(name).isPresent()) {
+ throw new IllegalArgumentException("Parameter with name '" + name + "' already exists.");
+ }
+
+ Parameter parameter = new Parameter(createCore(Parameter.class));
+
+ // relations
+ getCore(parameter).getPermanentStore().set(parameterSet);
+ getCore(parameterSet).getChildrenStore().add(parameter);
+
+ // properties
+ parameter.setName(name);
+ parameter.setObjectValue(value, unit);
+
+ return parameter;
+ }
+
+ /**
+ * Creates a new {@link ParameterSet} for given {@link Measurement}.
+ *
+ * @param name Name of the created {@code ParameterSet}.
+ * @param version Version of the created {@code ParameterSet}.
+ * @param measurement The owning {@code Measurement}.
+ * @return The created {@code ParameterSet} is returned.
+ */
+ public ParameterSet createParameterSet(String name, String version, Measurement measurement) {
+ ParameterSet parameterSet = new ParameterSet(createCore(ParameterSet.class));
+
+ // relations
+ getCore(parameterSet).getPermanentStore().set(measurement);
+ getCore(measurement).getChildrenStore().add(parameterSet);
+
+ // properties
+ parameterSet.setName(name);
+ parameterSet.setVersion(version);
+
+ return parameterSet;
+ }
+
+ /**
+ * Creates a new {@link ParameterSet} for given {@link Channel}.
+ *
+ * @param name Name of the created {@code ParameterSet}.
+ * @param version Version of the created {@code ParameterSet}.
+ * @param channel The owning {@code Channel}.
+ * @return The created {@code ParameterSet} is returned.
+ */
+ public ParameterSet createParameterSet(String name, String version, Channel channel) {
+ ParameterSet parameterSet = new ParameterSet(createCore(ParameterSet.class));
+
+ // relations
+ getCore(parameterSet).getPermanentStore().set(channel);
+ getCore(channel).getChildrenStore().add(parameterSet);
+
+ // properties
+ parameterSet.setName(name);
+ parameterSet.setVersion(version);
+
+ return parameterSet;
+ }
+
+ /**
+ * Creates a new {@link PhysicalDimension}.
+ *
+ * @param name Name of the created {@code PhysicalDimension}.
+ * @return The created {@code PhysicalDimension} is returned.
+ */
+ public PhysicalDimension createPhysicalDimension(String name) {
+ PhysicalDimension physicalDimension = new PhysicalDimension(createCore(PhysicalDimension.class));
+
+ // properties
+ physicalDimension.setName(name);
+ physicalDimension.setLength(Integer.valueOf(0));
+ physicalDimension.setMass(Integer.valueOf(0));
+ physicalDimension.setTime(Integer.valueOf(0));
+ physicalDimension.setTemperature(Integer.valueOf(0));
+ physicalDimension.setCurrent(Integer.valueOf(0));
+ physicalDimension.setMolarAmount(Integer.valueOf(0));
+ physicalDimension.setLuminousIntensity(Integer.valueOf(0));
+ physicalDimension.setAngle(Integer.valueOf(0));
+
+ return physicalDimension;
+ }
+
+ /**
+ * Creates a new {@link Quantity}.
+ *
+ * @param name Name of the created {@code Quantity}.
+ * @param defaultUnit The default {@link Unit}.
+ * @return The created {@code Quantity} is returned.
+ */
+ public Quantity createQuantity(String name, Unit defaultUnit) {
+ Quantity quantity = new Quantity(createCore(Quantity.class));
+
+ // relations
+ getCore(quantity).getMutableStore().set(defaultUnit);
+
+ // properties
+ quantity.setName(name);
+ quantity.setDateCreated(LocalDateTime.now());
+ quantity.setDefaultRank(Integer.valueOf(1));
+ quantity.setDefaultDimension(new int[] { 0 });
+ quantity.setDefaultTypeSize(Integer.valueOf(1));
+ quantity.setDefaultChannelName(name);
+ quantity.setDefaultScalarType(ScalarType.FLOAT);
+
+ quantity.getValue("Version").set("1");
+ quantity.getValue("ValidFlag").set(VersionState.VALID);
+
+ return quantity;
+ }
+
+ /**
+ * Creates a new {@link Test} with a reference to the logged in {@link User}, if
+ * there is one.
+ *
+ * @param name Name of the created {@code Test}.
+ * @return The created {@code Test} is returned.
+ */
+ public Test createTest(String name) {
+ Test test = new Test(createCore(Test.class));
+
+ // relations
+ Optional<User> responsiblePerson = getLoggedInUser();
+ if (responsiblePerson.isPresent()) {
+ // may be null if user entities are not available
+ getCore(test).getMutableStore().set(responsiblePerson.get());
+ }
+
+ // properties
+ test.setName(name);
+ test.setDateCreated(LocalDateTime.now());
+
+ return test;
+ }
+
+ /**
+ * Creates a new {@link TestStep}.
+ *
+ * @param name Name of the created {@code TestStep}.
+ * @param test The parent {@link Test}.
+ * @return The created {@code TestStep} is returned.
+ */
+ public TestStep createTestStep(String name, Test test) {
+ TestStep testStep = new TestStep(createCore(TestStep.class));
+
+ // relations
+ getCore(testStep).getPermanentStore().set(test);
+ getCore(test).getChildrenStore().add(testStep);
+
+ // properties
+ testStep.setName(name);
+ testStep.setDateCreated(LocalDateTime.now());
+ testStep.setOptional(Boolean.TRUE);
+
+ if (test.getID() != null && test.getID().length() > 0) {
+ // highest sort index in use will be queried before written
+ testStep.setSortIndex(Integer.valueOf(-1));
+ } else {
+ testStep.setSortIndex(nextIndex(getCore(test).getChildrenStore().get(TestStep.class)));
+ }
+
+ return testStep;
+ }
+
+ /**
+ * Creates a new {@link Unit}.
+ *
+ * @param name Name of the created {@code Unit}.
+ * @param physicalDimension The {@link PhysicalDimension}.
+ * @return The created {@code Unit} is returned.
+ */
+ public Unit createUnit(String name, PhysicalDimension physicalDimension) {
+ Unit unit = new Unit(createCore(Unit.class));
+
+ // relations
+ getCore(unit).getMutableStore().set(physicalDimension);
+
+ // properties
+ unit.setName(name);
+ unit.setOffset(Double.valueOf(0D));
+ unit.setFactor(Double.valueOf(1D));
+
+ return unit;
+ }
+
+ /**
+ * Creates a new {@link User}.
+ *
+ * @param name Name of the created {@code User}.
+ * @param givenName Given name of the created {@code User}.
+ * @param surname Surname of the created {@code User}.
+ * @return The created {@code User} is returned.
+ */
+ public User createUser(String name, String givenName, String surname) {
+ User user = new User(createCore(User.class));
+
+ // properties
+ user.setName(name);
+ user.setGivenName(givenName);
+ user.setSurname(surname);
+
+ return user;
+ }
+
+ // ======================================================================
+ // Protected methods
+ // ======================================================================
+
+ /**
+ * Creates a new {@link ContextRoot}.
+ *
+ * @param name Name of the created {@code ContextRoot}.
+ * @param contextType {@link ContextType} of the created {@code ContextRoot}.
+ * @return The created {@code ContextRoot} is returned.
+ */
+ protected ContextRoot createContextRoot(String name, ContextType contextType) {
+ ContextRoot contextRoot = new ContextRoot(createCore(ContextRoot.class, contextType));
+
+ // properties
+ contextRoot.setName(name);
+ contextRoot.setVersion(String.valueOf(0));
+
+ return contextRoot;
+ }
+
+ /**
+ * Creates a new {@link ContextComponent}.
+ *
+ * @param name Name of the created {@code ContextComponent}.
+ * @param contextRoot The parent {@link ContextRoot}.
+ * @return The created {@code ContextComponent} is returned.
+ */
+ protected ContextComponent createContextComponent(String name, ContextRoot contextRoot) {
+ ContextComponent contextComponent = new ContextComponent(createCore(name, ContextComponent.class));
+
+ // relations
+ getCore(contextComponent).getPermanentStore().set(contextRoot);
+ getCore(contextRoot).getChildrenStore().add(contextComponent);
+
+ // properties
+ contextComponent.setName(name);
+
+ return contextComponent;
+ }
+
+ /**
+ * Creates a new {@link ContextSensor}.
+ *
+ * @param name Name of the created {@code ContextSensor}.
+ * @param contextComponent The parent {@link ContextComponent}.
+ * @return The created {@code ContextSensor} is returned.
+ */
+ protected ContextSensor createContextSensor(String name, ContextComponent contextComponent) {
+ ContextSensor contextSensor = new ContextSensor(createCore(name, ContextSensor.class));
+ // relations
+ getCore(contextSensor).getPermanentStore().set(contextComponent);
+ getCore(contextComponent).getChildrenStore().add(contextSensor);
+
+ // properties
+ contextSensor.setName(name);
+
+ return contextSensor;
+ }
+
+ /**
+ * Returns the next usable sort index for given {@code List} of
+ * {@link Sortable}s.
+ *
+ * @param sortables The {@code Sortable} whose max sort index will be searched.
+ * @return {@code 1} is returned if given {@code List} is empty, otherwise the
+ * max sort index increased by 1 is returned.
+ */
+ protected static final Integer nextIndex(List<? extends Sortable> sortables) {
+ Optional<Integer> maxIndex = sortables.stream().max(Sortable.COMPARATOR).map(Sortable::getSortIndex);
+ return Integer.valueOf(maxIndex.isPresent() ? maxIndex.get().intValue() + 1 : 1);
+ }
+
+ /**
+ * Returns the {@link ChildrenStore} for given {@link BaseEntity}. Please be
+ * aware that the contents of this store is subject to the adapter creating it.
+ * It is up to the adapter to decide which related entities are included. As
+ * there are adapter specific details to the contents of the store it should be
+ * protected from external access. Therefore by declaring this method protected,
+ * the related functionality is hidden from other classes since the only classes
+ * which can access them (outside this package) are derivatives of
+ * BaseEntityFactory, and it is through such derivatives that BaseEntity's
+ * Stores should be accessed elsewhere if needed.
+ *
+ * @param entity The {@code BaseEntity} whose {@code ChildrenStore} will be
+ * returned.
+ * @return The {@code ChildrenStore} is returned.
+ */
+ protected static ChildrenStore getChildrenStore(BaseEntity entity) {
+ return getCore(entity).getChildrenStore();
+ }
+
+ /**
+ * Returns the mutable {@link EntityStore} for given {@link BaseEntity}. Please
+ * be aware that the contents of this store is subject to the adapter creating
+ * it. It is up to the adapter to decide which related entities are included. As
+ * there are adapter specific details to the contents of the store it should be
+ * protected from external access. Therefore by declaring this method protected,
+ * the related functionality is hidden from other classes since the only classes
+ * which can access them (outside this package) are derivatives of
+ * BaseEntityFactory, and it is through such derivatives that BaseEntity's
+ * Stores should be accessed elsewhere if needed.
+ *
+ *
+ * @param entity The {@code BaseEntity} whose {@code ChildrenStore} will be
+ * returned.
+ * @return The mutable {@code EntityStore} is returned.
+ */
+ protected static EntityStore getMutableStore(BaseEntity entity) {
+ return getCore(entity).getMutableStore();
+ }
+
+ /**
+ * Returns the permanent {@link EntityStore} for given {@link BaseEntity}.
+ * Please be aware that the contents of this store is subject to the adapter
+ * creating it. It is up to the adapter to decide which related entities are
+ * included. As there are adapter specific details to the contents of the store
+ * it should be protected from external access. Therefore by declaring this
+ * method protected, the related functionality is hidden from other classes
+ * since the only classes which can access them (outside this package) are
+ * derivatives of BaseEntityFactory, and it is through such derivatives that
+ * BaseEntity's Stores should be accessed elsewhere if needed.
+ *
+ * @param entity The {@code BaseEntity} whose {@code ChildrenStore} will be
+ * returned.
+ * @return The permanent {@code EntityStore} is returned.
+ */
+ protected static EntityStore getPermanentStore(BaseEntity entity) {
+ return getCore(entity).getPermanentStore();
+ }
+
+ /**
+ * Returns {@link Core} of given {@link Entity}. Uses protected method from
+ * BaseEntity, which is accessible here as BaseEntity resides in the same
+ * package as BaseEntityFactory. By declaring this method protected, the
+ * Core-related functionality is hidden from other classes since the only
+ * classes which can access them (outside this package) are derivatives of
+ * BaseEntityFactory, and it is through such derivatives that a BaseEntity's
+ * Core should be accessed elsewhere if needed.
+ *
+ * @param entity The {@code BaseEntity} whose {@code Core} is required.
+ * @return The {@code Core} is returned.
+ */
+ protected static final Core getCore(BaseEntity entity) {
+ return entity.getCore();
+ }
+
+ /**
+ * Create an instance of {@link BaseEntity} (or derivative) with core as the
+ * instance's {@link Core}. By declaring this method protected, the Core-related
+ * functionality is hidden from other classes since the only classes which can
+ * access them (outside this package) are derivatives of BaseEntityFactory, and
+ * it is through such derivatives that a BaseEntity's Core should be accessed
+ * elsewhere if needed. <br>
+ * <br>
+ * This method accesses the (usually protected) Constructor(Core) of clazz, so
+ * this method should be overridden in a derived class and call
+ * super.createBaseEntity() if that constructor is invisible from the derived
+ * class.
+ *
+ * @param clazz The class to instantiate, must extend {@link BaseEntity}.
+ * @param core The {@link Core} to use for the newly created instance.
+ * @return The newly created instance.
+ */
+ protected <T extends BaseEntity> T createBaseEntity(Class<T> clazz, Core core) {
+ try {
+ Constructor<T> constructor = clazz.getDeclaredConstructor(Core.class);
+ try {
+ return constructor.newInstance(core);
+ } catch (IllegalAccessException exc) {
+ throw new IllegalStateException("Cannot access Constructor(Core) of class '" + clazz.getName() + "'!");
+ }
+ } catch (NoSuchMethodException | InvocationTargetException | InstantiationException exc) {
+ throw new IllegalStateException(exc.getMessage(), exc);
+ }
+ }
+
+ /**
+ * Returns the {@link User} which is bound to the current session.
+ *
+ * @return {@code Optional} is empty if {@code User} entities do not exist.
+ */
+ protected abstract Optional<User> getLoggedInUser();
+
+ /**
+ * Returns a new {@link Core} for given entity class.
+ *
+ * @param <T> The entity class type.
+ * @param entityClass The entity class.
+ * @return A new {@code Core} instance is returned.
+ */
+ protected abstract <T extends Entity> Core createCore(Class<T> entityClass);
+
+ /**
+ * Returns a new {@link Core} for given entity class and {@link ContextType}.
+ *
+ * @param <T> The entity class type.
+ * @param entityClass The entity class.
+ * @param contextType The {@code ContextType}.
+ * @return A new {@code Core} instance is returned.
+ */
+ protected abstract <T extends Entity> Core createCore(Class<T> entityClass, ContextType contextType);
+
+ /**
+ * Returns a new {@link Core} for given entity class and type name.
+ *
+ * @param <T> The entity class type.
+ * @param name Name of the entity type.
+ * @param entityClass The entity class.
+ * @return A new {@code Core} instance is returned.
+ */
+ protected abstract <T extends Entity> Core createCore(String name, Class<T> entityClass);
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/BaseParameter.java b/src/main/java/org/eclipse/mdm/api/base/model/BaseParameter.java
index 029464d..6726c1b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/BaseParameter.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/BaseParameter.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -91,12 +90,9 @@
/**
* Constructor.
*
- * @param attrScalarType
- * Name of the {@link ScalarType} attribute.
- * @param attrValue
- * Name of the {@code String} value attribute.
- * @param core
- * The {@link Core}.
+ * @param attrScalarType Name of the {@link ScalarType} attribute.
+ * @param attrValue Name of the {@code String} value attribute.
+ * @param core The {@link Core}.
*/
protected BaseParameter(String attrScalarType, String attrValue, Core core) {
super(core);
@@ -109,11 +105,10 @@
// ======================================================================
/**
- * Creates a virtual representation of this parameter's value. This is done
- * by converting the internally stored {@code String} value to type
- * specified by this parameter's {@link ValueType} (the allowed types are
- * listed below). The name of the returned virtual {@link Value} is the name
- * of this parameter.
+ * Creates a virtual representation of this parameter's value. This is done by
+ * converting the internally stored {@code String} value to type specified by
+ * this parameter's {@link ValueType} (the allowed types are listed below). The
+ * name of the returned virtual {@link Value} is the name of this parameter.
*
* <ul>
* <li>{@link ValueType#STRING}</li>
@@ -139,8 +134,8 @@
public Value getVirtualValue() {
ScalarType scalarType = getScalarType();
Function<String, Object> typeConverter = SCALARTYPE_FUNCTION_MAP.get(scalarType);
-
- if(typeConverter == null) {
+
+ if (typeConverter == null) {
return ValueType.UNKNOWN.create(getName());
}
@@ -151,23 +146,19 @@
/**
* Takes given value and determines its type. Finally value and the optional
- * {@code Unit} are passed to the corresponding {@code setXYValue(XY)}
- * method as listed below. The value is allowed to be an instance of the
- * following types: {@code String}, {@code LocalDateTime}, {@code Boolean},
- * {@code Byte}, {@code Short}, {@code Integer}, {@code Long},
- * {@code Float}, {@code Double}, {@code FloatComplex} and
- * {@code DoubleComplex}.
+ * {@code Unit} are passed to the corresponding {@code setXYValue(XY)} method as
+ * listed below. The value is allowed to be an instance of the following types:
+ * {@code String}, {@code LocalDateTime}, {@code Boolean}, {@code Byte},
+ * {@code Short}, {@code Integer}, {@code Long}, {@code Float}, {@code Double},
+ * {@code FloatComplex} and {@code DoubleComplex}.
*
* <p>
* <b>Note:</b> If the given value is an instance of {@code String}, {@code
* LocalDateTime} or a {@code Boolean}, then the given unit is ignored.
*
- * @param value
- * The new value for this parameter is not allowed to be null.
- * @param unit
- * The optionally related {@code Unit}.
- * @throws IllegalArgumentException
- * Thrown if the given value is not supported.
+ * @param value The new value for this parameter is not allowed to be null.
+ * @param unit The optionally related {@code Unit}.
+ * @throws IllegalArgumentException Thrown if the given value is not supported.
* @see #setStringValue(String)
* @see #setDateValue(LocalDateTime)
* @see #setBooleanValue(Boolean)
@@ -210,11 +201,10 @@
}
/**
- * Replaces current value with given {@code String} value. Any existing
- * relation to a {@link Unit} will be removed.
+ * Replaces current value with given {@code String} value. Any existing relation
+ * to a {@link Unit} will be removed.
*
- * @param value
- * The new value for this parameter.
+ * @param value The new value for this parameter.
*/
public void setStringValue(String value) {
setScalarType(ScalarType.STRING);
@@ -227,8 +217,7 @@
* {@code LocalDateTime}. Any existing relation to a {@link Unit} will be
* removed.
*
- * @param value
- * The new value for this parameter.
+ * @param value The new value for this parameter.
*/
public void setDateValue(LocalDateTime value) {
setScalarType(ScalarType.DATE);
@@ -240,8 +229,7 @@
* Replaces current value with the {@code String} representation of given
* {@code Boolean}. Any existing relation to a {@link Unit} will be removed.
*
- * @param value
- * The new value for this parameter.
+ * @param value The new value for this parameter.
*/
public void setBooleanValue(Boolean value) {
setScalarType(ScalarType.BOOLEAN);
@@ -251,13 +239,11 @@
/**
* Replaces current value with the {@code String} representation of given
- * {@code Byte}. Any existing relation to a {@link Unit} will be replaced
- * with the given one.
+ * {@code Byte}. Any existing relation to a {@link Unit} will be replaced with
+ * the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setByteValue(Byte value, Unit unit) {
setScalarType(ScalarType.BYTE);
@@ -267,13 +253,11 @@
/**
* Replaces current value with the {@code String} representation of given
- * {@code Short}. Any existing relation to a {@link Unit} will be replaced
- * with the given one.
+ * {@code Short}. Any existing relation to a {@link Unit} will be replaced with
+ * the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setShortValue(Short value, Unit unit) {
setScalarType(ScalarType.SHORT);
@@ -286,10 +270,8 @@
* {@code Integer}. Any existing relation to a {@link Unit} will be replaced
* with the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setIntegerValue(Integer value, Unit unit) {
setScalarType(ScalarType.INTEGER);
@@ -299,13 +281,11 @@
/**
* Replaces current value with the {@code String} representation of given
- * {@code Long}. Any existing relation to a {@link Unit} will be replaced
- * with the given one.
+ * {@code Long}. Any existing relation to a {@link Unit} will be replaced with
+ * the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setLongValue(Long value, Unit unit) {
setScalarType(ScalarType.LONG);
@@ -315,13 +295,11 @@
/**
* Replaces current value with the {@code String} representation of given
- * {@code Float}. Any existing relation to a {@link Unit} will be replaced
- * with the given one.
+ * {@code Float}. Any existing relation to a {@link Unit} will be replaced with
+ * the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setFloatValue(Float value, Unit unit) {
setScalarType(ScalarType.FLOAT);
@@ -331,13 +309,11 @@
/**
* Replaces current value with the {@code String} representation of given
- * {@code Double}. Any existing relation to a {@link Unit} will be replaced
- * with the given one.
+ * {@code Double}. Any existing relation to a {@link Unit} will be replaced with
+ * the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setDoubleValue(Double value, Unit unit) {
setScalarType(ScalarType.DOUBLE);
@@ -350,10 +326,8 @@
* {@code FloatComplex}. Any existing relation to a {@link Unit} will be
* replaced with the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setFloatComplexValue(FloatComplex value, Unit unit) {
setScalarType(ScalarType.FLOAT_COMPLEX);
@@ -366,10 +340,8 @@
* {@code DoubleComplex}. Any existing relation to a {@link Unit} will be
* replaced with the given one.
*
- * @param value
- * The new value for this parameter.
- * @param unit
- * The relation to a unit is optional.
+ * @param value The new value for this parameter.
+ * @param unit The relation to a unit is optional.
*/
public void setDoubleComplexValue(DoubleComplex value, Unit unit) {
setScalarType(ScalarType.DOUBLE_COMPLEX);
@@ -423,16 +395,15 @@
/**
* Sets new scalar type for this parameter.
*
- * @param scalarType
- * The new {@code ScalarType}.
+ * @param scalarType The new {@code ScalarType}.
*/
private void setScalarType(ScalarType scalarType) {
getValue(attrScalarType).set(scalarType);
}
/**
- * Returns the name of the related {@link Unit}. If no {@code Unit} is
- * related, an empty {@code String} is returned instead.
+ * Returns the name of the related {@link Unit}. If no {@code Unit} is related,
+ * an empty {@code String} is returned instead.
*
* @return The name of the related {@code Unit} is returned or an empty
* {@code String}.
@@ -449,8 +420,7 @@
/**
* Returns an optionally related {@link Unit}.
*
- * @return The returned {@code Optional} is empty if no {@code Unit} is
- * related.
+ * @return The returned {@code Optional} is empty if no {@code Unit} is related.
*/
private Optional<Unit> getUnit() {
return Optional.ofNullable(getCore().getMutableStore().get(Unit.class));
@@ -460,8 +430,7 @@
* Replaces current {@link Unit} relation with the given one, if the {@code
* Optional} is not empty. Otherwise any current relations is removed.
*
- * @param unit
- * The new {@code Unit} may be {@code null}.
+ * @param unit The new {@code Unit} may be {@code null}.
*/
private void setUnit(Unit unit) {
if (unit == null) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Channel.java b/src/main/java/org/eclipse/mdm/api/base/model/Channel.java
index f0f86be..98ce2d8 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Channel.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Channel.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -99,8 +98,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Channel(Core core) {
super(core);
@@ -122,8 +120,7 @@
/**
* Sets new minimum value for this channel.
*
- * @param minimum
- * The new minimum value.
+ * @param minimum The new minimum value.
*/
public void setMinimum(Double minimum) {
getValue(ATTR_MINIMUM).set(minimum);
@@ -141,8 +138,7 @@
/**
* Sets new maximum value for this channel.
*
- * @param maximum
- * The new maximum value.
+ * @param maximum The new maximum value.
*/
public void setMaximum(Double maximum) {
getValue(ATTR_MAXIMUM).set(maximum);
@@ -160,8 +156,7 @@
/**
* Sets new average value for this channel.
*
- * @param average
- * The new average value.
+ * @param average The new average value.
*/
public void setAverage(Double average) {
getValue(ATTR_AVERAGE).set(average);
@@ -179,8 +174,7 @@
/**
* Sets new deviation value for this channel.
*
- * @param deviation
- * The new deviation value.
+ * @param deviation The new deviation value.
*/
public void setDeviation(Double deviation) {
getValue(ATTR_DEVIATION).set(deviation);
@@ -198,11 +192,9 @@
/**
* Sets new {@link ScalarType} for this channel.
*
- * @param scalarType
- * The new {@code ScalarType}.
- * @throws IllegalArgumentException
- * Thrown if given {@code ScalarType} is
- * {@link ScalarType#UNKNOWN}.
+ * @param scalarType The new {@code ScalarType}.
+ * @throws IllegalArgumentException Thrown if given {@code ScalarType} is
+ * {@link ScalarType#UNKNOWN}.
*/
public void setScalarType(ScalarType scalarType) {
if (scalarType.isUnknown()) {
@@ -224,8 +216,7 @@
/**
* Sets new interpolation for this channel.
*
- * @param interpolation
- * The new {@code Interpolation}.
+ * @param interpolation The new {@code Interpolation}.
*/
public void setInterpolation(Interpolation interpolation) {
getValue(ATTR_INTERPOLATION).set(interpolation);
@@ -243,8 +234,7 @@
/**
* Sets new rank for this channel.
*
- * @param rank
- * The new rank.
+ * @param rank The new rank.
*/
public void setRank(Integer rank) {
getValue(ATTR_RANK).set(rank);
@@ -262,8 +252,7 @@
/**
* Sets new type size for this channel.
*
- * @param typeSize
- * The new type size.
+ * @param typeSize The new type size.
*/
public void setTypeSize(Integer typeSize) {
getValue(ATTR_TYPE_SIZE).set(typeSize);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ChannelGroup.java b/src/main/java/org/eclipse/mdm/api/base/model/ChannelGroup.java
index 7a10e88..b7d1bc4 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ChannelGroup.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ChannelGroup.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -53,8 +52,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
ChannelGroup(Core core) {
super(core);
@@ -76,8 +74,7 @@
/**
* Sets new number of values for this channel group.
*
- * @param numberOfValues
- * The new number of values.
+ * @param numberOfValues The new number of values.
*/
public void setNumberOfValues(Integer numberOfValues) {
getValue(ATTR_NUMBER_OF_VALUES).set(numberOfValues);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ContextComponent.java b/src/main/java/org/eclipse/mdm/api/base/model/ContextComponent.java
index 749ba95..f87e65d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ContextComponent.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ContextComponent.java
@@ -1,120 +1,116 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.model;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import org.eclipse.mdm.api.base.adapter.Core;
-
-/**
- * Implementation of the context component entity types. Instances of this class
- * are only provided / managed via the owning descriptive {@link ContextRoot}.
- * Additionally if the owning {@code ContextRoot} is of type
- * {@link ContextType#TESTEQUIPMENT} this context component may have relations
- * to {@link ContextSensor}s whose names have to be unique.
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
- */
-public class ContextComponent extends BaseEntity implements Deletable {
-
- // ======================================================================
- // Constructors
- // ======================================================================
-
- /**
- * Constructor.
- *
- * @param core
- * The {@link Core}.
- */
- ContextComponent(Core core) {
- super(core);
- }
-
- // ======================================================================
- // Public methods
- // ======================================================================
-
- /**
- * Returns the {@link ContextSensor} identified by given name.
- *
- * @param name
- * The name of the {@code ContextSensor}.
- * @return The {@code Optional} is empty if a {@code ContextSensor} with
- * given name does not exist.
- */
- public Optional<ContextSensor> getContextSensor(String name) {
- return getContextSensors().stream().filter(cs -> cs.nameEquals(name)).findAny();
- }
-
- /**
- * Returns all available {@link ContextSensor}s related to this context
- * component.
- *
- * @return The returned {@code List} is unmodifiable.
- */
- public List<ContextSensor> getContextSensors() {
- return getCore().getChildrenStore().get(ContextSensor.class);
- }
-
- /**
- * Returns the {@link ContextRoot} this context component belongs to.
- *
- * @return The parent {@link ContextRoot}.
- */
- public ContextRoot getContextRoot() {
- return getCore().getPermanentStore().get(ContextRoot.class);
- }
-
- /**
- * Removes the {@link ContextSensor} identified by given name.
- *
- * @param name
- * Name of the {@code ContextSensor} that has to be removed.
- * @return Returns {@code true} if the {@code ContextSensor} with given name
- * has been removed.
- */
- public boolean removeContextSensor(String name) {
- Optional<ContextSensor> catalogSensor = getContextSensor(name);
- if (catalogSensor.isPresent()) {
- getCore().getChildrenStore().remove(catalogSensor.get());
- return true;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
- sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
-
- List<ContextSensor> contextSensors = getContextSensors();
- if (!contextSensors.isEmpty()) {
- sb.append(", ContextSensors = ").append(contextSensors);
- }
-
- return sb.append(')').toString();
- }
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+
+/**
+ * Implementation of the context component entity types. Instances of this class
+ * are only provided / managed via the owning descriptive {@link ContextRoot}.
+ * Additionally if the owning {@code ContextRoot} is of type
+ * {@link ContextType#TESTEQUIPMENT} this context component may have relations
+ * to {@link ContextSensor}s whose names have to be unique.
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
+ */
+public class ContextComponent extends BaseEntity implements Deletable {
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ ContextComponent(Core core) {
+ super(core);
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ /**
+ * Returns the {@link ContextSensor} identified by given name.
+ *
+ * @param name The name of the {@code ContextSensor}.
+ * @return The {@code Optional} is empty if a {@code ContextSensor} with given
+ * name does not exist.
+ */
+ public Optional<ContextSensor> getContextSensor(String name) {
+ return getContextSensors().stream().filter(cs -> cs.nameEquals(name)).findAny();
+ }
+
+ /**
+ * Returns all available {@link ContextSensor}s related to this context
+ * component.
+ *
+ * @return The returned {@code List} is unmodifiable.
+ */
+ public List<ContextSensor> getContextSensors() {
+ return getCore().getChildrenStore().get(ContextSensor.class);
+ }
+
+ /**
+ * Returns the {@link ContextRoot} this context component belongs to.
+ *
+ * @return The parent {@link ContextRoot}.
+ */
+ public ContextRoot getContextRoot() {
+ return getCore().getPermanentStore().get(ContextRoot.class);
+ }
+
+ /**
+ * Removes the {@link ContextSensor} identified by given name.
+ *
+ * @param name Name of the {@code ContextSensor} that has to be removed.
+ * @return Returns {@code true} if the {@code ContextSensor} with given name has
+ * been removed.
+ */
+ public boolean removeContextSensor(String name) {
+ Optional<ContextSensor> catalogSensor = getContextSensor(name);
+ if (catalogSensor.isPresent()) {
+ getCore().getChildrenStore().remove(catalogSensor.get());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
+ sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
+
+ List<ContextSensor> contextSensors = getContextSensors();
+ if (!contextSensors.isEmpty()) {
+ sb.append(", ContextSensors = ").append(contextSensors);
+ }
+
+ return sb.append(')').toString();
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ContextDescribable.java b/src/main/java/org/eclipse/mdm/api/base/model/ContextDescribable.java
index bf150d9..a884d1f 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ContextDescribable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ContextDescribable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -34,15 +33,13 @@
*/
public interface ContextDescribable extends Entity {
/**
- * Queries available {@link ContextType} for given
- * {@link ContextDescribable}.
+ * Queries available {@link ContextType} for given {@link ContextDescribable}.
*
- * @param manager
- * An object implementing BaseEntityManager.
+ * @param manager An object implementing BaseEntityManager.
* @return {@code List} contains the {@code ContextType} of each referenced
* {@link ContextRoot}.
- * @throws DataAccessException
- * Thrown if unable to query the available {@code ContextType}s.
+ * @throws DataAccessException Thrown if unable to query the available
+ * {@code ContextType}s.
*/
List<ContextType> loadContextTypes(BaseEntityManager manager) throws DataAccessException;
@@ -50,16 +47,13 @@
* Loads the requested {@link ContextRoot}s for given
* {@link ContextDescribable}.
*
- * @param manager
- * An object implementing BaseEntityManager.
- * @param contextTypes
- * The requested context types. If omitted, all types are be
- * loaded.
- * @return The ordered contexts for given {@code TestStep} or the measured
- * ones for {@code Measurement} are returned in a {@code Map}.
- * @throws DataAccessException
- * Thrown if unable to retrieve the {@code
- * ContextRoot}s.
+ * @param manager An object implementing BaseEntityManager.
+ * @param contextTypes The requested context types. If omitted, all types are be
+ * loaded.
+ * @return The ordered contexts for given {@code TestStep} or the measured ones
+ * for {@code Measurement} are returned in a {@code Map}.
+ * @throws DataAccessException Thrown if unable to retrieve the {@code
+ * ContextRoot} s.
* @see ContextType
*/
Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager, ContextType... contextTypes)
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ContextRoot.java b/src/main/java/org/eclipse/mdm/api/base/model/ContextRoot.java
index ce3c709..4ba4517 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ContextRoot.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ContextRoot.java
@@ -1,217 +1,208 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import org.eclipse.mdm.api.base.adapter.Core;
-
-/**
- * Implementation of the context root entity types. This is the root node of the
- * descriptive component structure for a {@link ContextType}. This element is
- * used for both, order and measured result description data. If it belongs to
- * an order description, then a relation to a {@link TestStep} exists. Otherwise
- * it represents the description of a measurement and therefore has one ore more
- * relations to {@link Measurement}s. In the base application model the
- * component structure is provided as is. An extension of the base application
- * model may define a template, the structure of contained
- * {@link ContextComponent}s and {@link ContextSensor}s will be restricted to.
- * Additionally the <b>names</b> of all related {@code ContextComponent}s have
- * to be unique.
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
- */
-public class ContextRoot extends BaseEntity implements Deletable {
-
- // ======================================================================
- // Class variables
- // ======================================================================
-
- /**
- * The 'Version' attribute name.
- */
- public static final String ATTR_VERSION = "Version";
-
- // ======================================================================
- // Instance variables
- // ======================================================================
-
- private final ContextType contextType;
-
- // ======================================================================
- // Constructors
- // ======================================================================
-
- /**
- * Constructor.
- *
- * @param core
- * The {@link Core}.
- */
- ContextRoot(Core core) {
- super(core);
- contextType = ContextType.valueOf(core.getTypeName().toUpperCase(Locale.ROOT));
- }
-
- // ======================================================================
- // Public methods
- // ======================================================================
-
- /**
- * Returns the {@link ContextType} of this context root.
- *
- * @return The {@code ContextType} is returned.
- */
- public ContextType getContextType() {
- return contextType;
- }
-
- /**
- * Returns the {@link ContextComponent} identified by given name.
- *
- * @param name
- * The name of the {@code ContextComponent}.
- * @return The {@code Optional} is empty if a {@code ContextComponent} with
- * given name does not exist.
- */
- public Optional<ContextComponent> getContextComponent(String name) {
- return getContextComponents().stream().filter(cc -> cc.nameEquals(name)).findAny();
- }
-
- /**
- * Returns all available {@link ContextComponent}s related to this context
- * root.
- *
- * @return The returned {@code List} is unmodifiable.
- */
- public List<ContextComponent> getContextComponents() {
- return getCore().getChildrenStore().get(ContextComponent.class);
- }
-
- /**
- * Removes the {@link ContextComponent} identified by given name.
- *
- * @param name
- * Name of the {@code ContextComponent} that have to be removed.
- * @return Returns {@code true} if the {@code ContextComponent} with given
- * name has been removed.
- */
- public boolean removeContextComponent(String name) {
- Optional<ContextComponent> contextComponent = getContextComponent(name);
- if (contextComponent.isPresent()) {
- getCore().getChildrenStore().remove(contextComponent.get());
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns all available {@link ContextSensor}s related to the
- * {@link ContextComponent}s, which are held by this context root.
- *
- * @return The returned {@code List} will always be empty if this context
- * root is of type {@link ContextType#UNITUNDERTEST} or
- * {@link ContextType#TESTSEQUENCE}.
- */
- public List<ContextSensor> getContextSensors() {
- if (!getContextType().isTestEquipment()) {
- return Collections.emptyList();
- }
-
- return getContextComponents().stream().map(ContextComponent::getContextSensors).collect(ArrayList::new,
- List::addAll, List::addAll);
- }
-
- /**
- * Returns the version of this context root.
- *
- * @return The version is returned.
- */
- public String getVersion() {
- return getValue(ATTR_VERSION).extract();
- }
-
- /**
- * Sets new version for this context root.
- *
- * @param version
- * The new version.
- */
- public void setVersion(String version) {
- getValue(ATTR_VERSION).set(version);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
- sb.append("ContextType = ").append(getContextType()).append(", ");
- sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
-
- List<ContextComponent> contextComponents = getContextComponents();
- if (!contextComponents.isEmpty()) {
- sb.append(", ContextComponents = ").append(contextComponents);
- }
-
- return sb.append(')').toString();
- }
-
- /**
- * Convenience method to access the {@link ContextRoot}s of newly created
- * {@link ContextDescribable}.
- *
- * @param contextDescribable
- * Either a {@link TestStep} or a {@link Measurement}.
- * @return The {@code ContextRoot}s are returned.
- */
- public static List<ContextRoot> of(ContextDescribable contextDescribable) {
- List<ContextRoot> contextRoots = new ArrayList<>();
- of(contextDescribable, ContextType.UNITUNDERTEST).ifPresent(contextRoots::add);
- of(contextDescribable, ContextType.TESTSEQUENCE).ifPresent(contextRoots::add);
- of(contextDescribable, ContextType.TESTEQUIPMENT).ifPresent(contextRoots::add);
- return contextRoots;
- }
-
- // ======================================================================
- // Private methods
- // ======================================================================
-
- /**
- * Returns the {@link ContextRoot} with given {@link ContextType} from given
- * {@link ContextDescribable}.
- *
- * @param contextDescribable
- * Either a {@link TestStep} or a {@link Measurement}.
- * @param contextType
- * The requested {@code ContextType}.
- * @return {@code Optional} is empty if a {@code ContextRoot} with given
- * {@code ContextType} does not exist.
- */
- private static Optional<ContextRoot> of(ContextDescribable contextDescribable, ContextType contextType) {
- return Optional.ofNullable(getCore(contextDescribable).getMutableStore().get(ContextRoot.class, contextType));
- }
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+
+/**
+ * Implementation of the context root entity types. This is the root node of the
+ * descriptive component structure for a {@link ContextType}. This element is
+ * used for both, order and measured result description data. If it belongs to
+ * an order description, then a relation to a {@link TestStep} exists. Otherwise
+ * it represents the description of a measurement and therefore has one ore more
+ * relations to {@link Measurement}s. In the base application model the
+ * component structure is provided as is. An extension of the base application
+ * model may define a template, the structure of contained
+ * {@link ContextComponent}s and {@link ContextSensor}s will be restricted to.
+ * Additionally the <b>names</b> of all related {@code ContextComponent}s have
+ * to be unique.
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
+ */
+public class ContextRoot extends BaseEntity implements Deletable {
+
+ // ======================================================================
+ // Class variables
+ // ======================================================================
+
+ /**
+ * The 'Version' attribute name.
+ */
+ public static final String ATTR_VERSION = "Version";
+
+ // ======================================================================
+ // Instance variables
+ // ======================================================================
+
+ private final ContextType contextType;
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ ContextRoot(Core core) {
+ super(core);
+ contextType = ContextType.valueOf(core.getTypeName().toUpperCase(Locale.ROOT));
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ /**
+ * Returns the {@link ContextType} of this context root.
+ *
+ * @return The {@code ContextType} is returned.
+ */
+ public ContextType getContextType() {
+ return contextType;
+ }
+
+ /**
+ * Returns the {@link ContextComponent} identified by given name.
+ *
+ * @param name The name of the {@code ContextComponent}.
+ * @return The {@code Optional} is empty if a {@code ContextComponent} with
+ * given name does not exist.
+ */
+ public Optional<ContextComponent> getContextComponent(String name) {
+ return getContextComponents().stream().filter(cc -> cc.nameEquals(name)).findAny();
+ }
+
+ /**
+ * Returns all available {@link ContextComponent}s related to this context root.
+ *
+ * @return The returned {@code List} is unmodifiable.
+ */
+ public List<ContextComponent> getContextComponents() {
+ return getCore().getChildrenStore().get(ContextComponent.class);
+ }
+
+ /**
+ * Removes the {@link ContextComponent} identified by given name.
+ *
+ * @param name Name of the {@code ContextComponent} that have to be removed.
+ * @return Returns {@code true} if the {@code ContextComponent} with given name
+ * has been removed.
+ */
+ public boolean removeContextComponent(String name) {
+ Optional<ContextComponent> contextComponent = getContextComponent(name);
+ if (contextComponent.isPresent()) {
+ getCore().getChildrenStore().remove(contextComponent.get());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns all available {@link ContextSensor}s related to the
+ * {@link ContextComponent}s, which are held by this context root.
+ *
+ * @return The returned {@code List} will always be empty if this context root
+ * is of type {@link ContextType#UNITUNDERTEST} or
+ * {@link ContextType#TESTSEQUENCE}.
+ */
+ public List<ContextSensor> getContextSensors() {
+ if (!getContextType().isTestEquipment()) {
+ return Collections.emptyList();
+ }
+
+ return getContextComponents().stream().map(ContextComponent::getContextSensors).collect(ArrayList::new,
+ List::addAll, List::addAll);
+ }
+
+ /**
+ * Returns the version of this context root.
+ *
+ * @return The version is returned.
+ */
+ public String getVersion() {
+ return getValue(ATTR_VERSION).extract();
+ }
+
+ /**
+ * Sets new version for this context root.
+ *
+ * @param version The new version.
+ */
+ public void setVersion(String version) {
+ getValue(ATTR_VERSION).set(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
+ sb.append("ContextType = ").append(getContextType()).append(", ");
+ sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
+
+ List<ContextComponent> contextComponents = getContextComponents();
+ if (!contextComponents.isEmpty()) {
+ sb.append(", ContextComponents = ").append(contextComponents);
+ }
+
+ return sb.append(')').toString();
+ }
+
+ /**
+ * Convenience method to access the {@link ContextRoot}s of newly created
+ * {@link ContextDescribable}.
+ *
+ * @param contextDescribable Either a {@link TestStep} or a {@link Measurement}.
+ * @return The {@code ContextRoot}s are returned.
+ */
+ public static List<ContextRoot> of(ContextDescribable contextDescribable) {
+ List<ContextRoot> contextRoots = new ArrayList<>();
+ of(contextDescribable, ContextType.UNITUNDERTEST).ifPresent(contextRoots::add);
+ of(contextDescribable, ContextType.TESTSEQUENCE).ifPresent(contextRoots::add);
+ of(contextDescribable, ContextType.TESTEQUIPMENT).ifPresent(contextRoots::add);
+ return contextRoots;
+ }
+
+ // ======================================================================
+ // Private methods
+ // ======================================================================
+
+ /**
+ * Returns the {@link ContextRoot} with given {@link ContextType} from given
+ * {@link ContextDescribable}.
+ *
+ * @param contextDescribable Either a {@link TestStep} or a {@link Measurement}.
+ * @param contextType The requested {@code ContextType}.
+ * @return {@code Optional} is empty if a {@code ContextRoot} with given
+ * {@code ContextType} does not exist.
+ */
+ private static Optional<ContextRoot> of(ContextDescribable contextDescribable, ContextType contextType) {
+ return Optional.ofNullable(getCore(contextDescribable).getMutableStore().get(ContextRoot.class, contextType));
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ContextSensor.java b/src/main/java/org/eclipse/mdm/api/base/model/ContextSensor.java
index 2f408f5..37ea0f6 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ContextSensor.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ContextSensor.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -35,8 +34,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
ContextSensor(Core core) {
super(core);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ContextType.java b/src/main/java/org/eclipse/mdm/api/base/model/ContextType.java
index 0117ca0..fb5cdba 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ContextType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ContextType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -30,14 +29,12 @@
// ======================================================================
/**
- * A {@link ContextRoot} of this type unites meta data of the unit under
- * test.
+ * A {@link ContextRoot} of this type unites meta data of the unit under test.
*/
UNITUNDERTEST,
/**
- * A {@link ContextRoot} of this type unites meta data of the test
- * conditions.
+ * A {@link ContextRoot} of this type unites meta data of the test conditions.
*/
TESTSEQUENCE,
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Datable.java b/src/main/java/org/eclipse/mdm/api/base/model/Datable.java
index e1f2b33..2060ea1 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Datable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Datable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -52,8 +51,7 @@
/**
* Set new creation time stamp for this entity.
*
- * @param dateCreated
- * The new creation time stamp.
+ * @param dateCreated The new creation time stamp.
*/
default void setDateCreated(LocalDateTime dateCreated) {
getValue(ATTR_DATE_CREATED).set(dateCreated);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Deletable.java b/src/main/java/org/eclipse/mdm/api/base/model/Deletable.java
index 5453ca7..02a0dc9 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Deletable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Deletable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Describable.java b/src/main/java/org/eclipse/mdm/api/base/model/Describable.java
index 83484dc..2885696 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Describable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Describable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -50,8 +49,7 @@
/**
* Sets new description for this entity.
*
- * @param description
- * The new description.
+ * @param description The new description.
*/
default void setDescription(String description) {
getValue(ATTR_DESCRIPTION).set(description);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/DoubleComplex.java b/src/main/java/org/eclipse/mdm/api/base/model/DoubleComplex.java
index 37d8712..057a246 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/DoubleComplex.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/DoubleComplex.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -39,10 +38,8 @@
/**
* Constructor.
*
- * @param real
- * The real part.
- * @param imaginary
- * The imaginary part.
+ * @param real The real part.
+ * @param imaginary The imaginary part.
*/
public DoubleComplex(double real, double imaginary) {
re = real;
@@ -54,15 +51,13 @@
// ======================================================================
/**
- * Parses given {@code String} where real and imaginary parts are separated
- * by one or more blanks. Furthermore both must be floating point numbers
- * that can be parsed by calling {@link Double#valueOf(String)}.
+ * Parses given {@code String} where real and imaginary parts are separated by
+ * one or more blanks. Furthermore both must be floating point numbers that can
+ * be parsed by calling {@link Double#valueOf(String)}.
*
- * @param s
- * The {@code String} to be parsed.
+ * @param s The {@code String} to be parsed.
* @return The parsed {@link DoubleComplex} value is returned.
- * @throws NumberFormatException
- * Thrown if unable to parse the complex value.
+ * @throws NumberFormatException Thrown if unable to parse the complex value.
*/
public static DoubleComplex valueOf(String s) {
String[] values = s.split(" +");
@@ -92,8 +87,8 @@
}
/**
- * Returns a human readable {@code String} representation of this complex
- * value. The real and imaginary parts are separated with a blank.
+ * Returns a human readable {@code String} representation of this complex value.
+ * The real and imaginary parts are separated with a blank.
*
* @return The {@code String} representation of this complex value.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Entity.java b/src/main/java/org/eclipse/mdm/api/base/model/Entity.java
index e9524dc..1557d45 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Entity.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Entity.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -32,8 +31,7 @@
// ======================================================================
/**
- * This {@code Comparator} compares entities by their name in ascending
- * order.
+ * This {@code Comparator} compares entities by their name in ascending order.
*/
Comparator<Entity> COMPARATOR = Comparator.comparing(Entity::getName);
@@ -71,8 +69,7 @@
String getTypeName();
/**
- * Returns the instance ID or {@code 0} if this instance is not yet
- * persisted.
+ * Returns the instance ID or {@code 0} if this instance is not yet persisted.
*
* @return The instance ID is returned.
*/
@@ -90,8 +87,7 @@
/**
* Sets new name for this entity.
*
- * @param name
- * The new name.
+ * @param name The new name.
*/
default void setName(String name) {
getValue(ATTR_NAME).set(name);
@@ -109,8 +105,7 @@
/**
* Sets new {@link MimeType} for this entity.
*
- * @param mimeType
- * The new {@code MimeType}.
+ * @param mimeType The new {@code MimeType}.
*/
default void setMimeType(MimeType mimeType) {
getValue(ATTR_MIMETYPE).set(mimeType.toString());
@@ -119,15 +114,14 @@
/**
* Returns the {@link Value} container associated with given name.
*
- * @param name
- * Name of the attribute.
+ * @param name Name of the attribute.
* @return The {@code Value} container is returned.
*/
Value getValue(String name);
/**
- * Returns <i>all</i> {@link Value} containers of this entity mapped by
- * their name (no matter a value is valid or not).
+ * Returns <i>all</i> {@link Value} containers of this entity mapped by their
+ * name (no matter a value is valid or not).
*
* @return Returned {@code Map} is unmodifiable.
*/
@@ -144,10 +138,8 @@
/**
* Checks whether given name equals the name of this entity.
*
- * @param name
- * The checked name.
- * @return Returns {@code true} if given name equals the name of this
- * entity.
+ * @param name The checked name.
+ * @return Returns {@code true} if given name equals the name of this entity.
*/
default boolean nameEquals(String name) {
return getName().equals(name);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/EnumRegistry.java b/src/main/java/org/eclipse/mdm/api/base/model/EnumRegistry.java
index 2d7eb89..aea197b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/EnumRegistry.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/EnumRegistry.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -55,18 +54,15 @@
/**
* adds a new enumeration to the registry
*
- * @param name
- * the name under which the enumeration can be accessed
- * @param enumeration
- * the dynamic enumeration object
+ * @param name the name under which the enumeration can be accessed
+ * @param enumeration the dynamic enumeration object
*/
public void add(String name, Enumeration<? extends EnumerationValue> enumeration) {
enumerations.put(name, enumeration);
}
/**
- * @param name
- * the name of the registered enumeration
+ * @param name the name of the registered enumeration
* @return the dynamic enumeration object
*/
public Enumeration<?> get(String name) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Enumeration.java b/src/main/java/org/eclipse/mdm/api/base/model/Enumeration.java
index b074105..0d51b99 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Enumeration.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Enumeration.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -41,14 +40,12 @@
private Class<E> enumclass;
/**
- * Constructor. Static fields in the given enumclass of the same type are
- * added automatically as enum values. This way you can simply prefill the
- * object with static values.
+ * Constructor. Static fields in the given enumclass of the same type are added
+ * automatically as enum values. This way you can simply prefill the object with
+ * static values.
*
- * @param enumclass
- * the class of the enumeration values
- * @param name
- * the name of the enumeration bundle
+ * @param enumclass the class of the enumeration values
+ * @param name the name of the enumeration bundle
*/
@SuppressWarnings("unchecked")
public Enumeration(Class<E> enumclass, String name) {
@@ -80,7 +77,7 @@
fname = field.getName();
((EnumerationValue) fieldObject).setName(fname);
}
- addValue((E) fieldObject);
+ addValue((E) fieldObject);
}
}
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/EnumerationValue.java b/src/main/java/org/eclipse/mdm/api/base/model/EnumerationValue.java
index c61be41..dc549b5 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/EnumerationValue.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/EnumerationValue.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -77,10 +76,10 @@
/**
* This Constructor is protected to avoid accidental misuse.
*
- * be sure to initialize the enumeration fully, by either adding it as a
- * static field in an extending class, or setting the ordinal by hand.
- * You'll also have to add the resulting object to a DynamicEnumeration for
- * it to be completely usable.
+ * be sure to initialize the enumeration fully, by either adding it as a static
+ * field in an extending class, or setting the ordinal by hand. You'll also have
+ * to add the resulting object to a DynamicEnumeration for it to be completely
+ * usable.
*
* @param name
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Environment.java b/src/main/java/org/eclipse/mdm/api/base/model/Environment.java
index 8380345..a4c300b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Environment.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Environment.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -68,8 +67,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Environment(Core core) {
super(core);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/FileLink.java b/src/main/java/org/eclipse/mdm/api/base/model/FileLink.java
index e942d48..fcd0e5b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/FileLink.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/FileLink.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import java.io.IOException;
@@ -52,8 +51,7 @@
/**
* Constructor.
*
- * @param fileLink
- * Will be copied.
+ * @param fileLink Will be copied.
*/
FileLink(FileLink fileLink) {
remotePath = fileLink.remotePath;
@@ -67,10 +65,8 @@
/**
* Constructor.
*
- * @param remotePath
- * The remote path.
- * @param mimeType
- * The MIME type of the linked file.
+ * @param remotePath The remote path.
+ * @param mimeType The MIME type of the linked file.
*/
private FileLink(String remotePath, MimeType mimeType) {
this.remotePath = remotePath;
@@ -82,10 +78,8 @@
/**
* Constructor.
*
- * @param localPath
- * The local {@link Path}.
- * @throws IOException
- * Thrown in case of errors.
+ * @param localPath The local {@link Path}.
+ * @throws IOException Thrown in case of errors.
*/
private FileLink(Path localPath) throws IOException {
this.localPath = localPath;
@@ -107,12 +101,9 @@
/**
* Creates a new {@link FileLink} instance which remotely available.
*
- * @param remotePath
- * The remote path.
- * @param mimeType
- * The MIME type.
- * @param description
- * Description of the file.
+ * @param remotePath The remote path.
+ * @param mimeType The MIME type.
+ * @param description Description of the file.
* @return The created {@code FileLink} instance is returned.
*/
public static FileLink newRemote(String remotePath, MimeType mimeType, String description) {
@@ -124,12 +115,10 @@
/**
* Creates a new {@link FileLink} instance which locally available.
*
- * @param localPath
- * The local {@link Path} to the file.
+ * @param localPath The local {@link Path} to the file.
* @return The created {@code FileLink} instance is returned.
- * @throws IOException
- * Thrown if unable to access file with given {@code
- * Path}.
+ * @throws IOException Thrown if unable to access file with given {@code
+ * Path} .
*/
public static FileLink newLocal(Path localPath) throws IOException {
if (Files.isDirectory(localPath)) {
@@ -147,8 +136,7 @@
* Returns the name of the linked file.
*
* @return Name of the file is returned.
- * @throws IllegalStateException
- * Thrown if unable to retrieve the file name.
+ * @throws IllegalStateException Thrown if unable to retrieve the file name.
*/
public String getFileName() {
Path fileNamePath = null;
@@ -156,7 +144,8 @@
fileNamePath = getLocalPath().getFileName();
} else if (isRemote()) {
try {
- //on Windows, Paths.get() cannot handle file urls in the form file://REMOTE_HOST/path/filename
+ // on Windows, Paths.get() cannot handle file urls in the form
+ // file://REMOTE_HOST/path/filename
String fixedPath = remotePath.replaceFirst("file:", "");
fileNamePath = Paths.get(URLDecoder.decode(fixedPath, StandardCharsets.UTF_8.name())).getFileName();
} catch (UnsupportedEncodingException e) {
@@ -205,13 +194,11 @@
}
/**
- * This method is called by API providers to set the local {@link Path} once
- * the remote file was downloaded.
+ * This method is called by API providers to set the local {@link Path} once the
+ * remote file was downloaded.
*
- * @param localPath
- * The local {@code Path} of the downloaded file.
- * @throws IllegalStateException
- * Thrown if this file link is 'LOCAL'.
+ * @param localPath The local {@code Path} of the downloaded file.
+ * @throws IllegalStateException Thrown if this file link is 'LOCAL'.
*/
public void setLocalPath(Path localPath) {
if (State.LOCAL == state) {
@@ -245,13 +232,11 @@
}
/**
- * This method is called by API providers to set the remote path once the
- * local file has been uploaded.
+ * This method is called by API providers to set the remote path once the local
+ * file has been uploaded.
*
- * @param remotePath
- * The remote path of the uploaded file.
- * @throws IllegalStateException
- * Thrown if this file link is 'REMOTE'.
+ * @param remotePath The remote path of the uploaded file.
+ * @throws IllegalStateException Thrown if this file link is 'REMOTE'.
*/
public void setRemotePath(String remotePath) {
if (State.REMOTE == state) {
@@ -272,8 +257,7 @@
/**
* Sets a new description for the linked file.
*
- * @param description
- * The new description.
+ * @param description The new description.
*/
public void setDescription(String description) {
this.description = description;
@@ -291,8 +275,7 @@
/**
* Returns the formatted file size of the linked file.
*
- * @param format
- * Used to format the size.
+ * @param format Used to format the size.
* @return The formatted file size is returned.
*/
public String getSize(Format format) {
@@ -300,11 +283,10 @@
}
/**
- * This method is called by API providers to set the file size for the
- * linked file.
+ * This method is called by API providers to set the file size for the linked
+ * file.
*
- * @param size
- * The size of the file in bytes.
+ * @param size The size of the file in bytes.
*/
public void setFileSize(long size) {
this.size = size;
@@ -385,15 +367,13 @@
// ======================================================================
/**
- * Checks whether given {@link FileLink} may be treated as equal. This is
- * the case if either their local {@link Path}s or remote paths are equal.
+ * Checks whether given {@link FileLink} may be treated as equal. This is the
+ * case if either their local {@link Path}s or remote paths are equal.
*
- * @param o1
- * The first {@code FileLink}.
- * @param o2
- * The second {@code FileLink}.
- * @return Returns {@code true} if either their local {@code Path}s or
- * remote paths are equal.
+ * @param o1 The first {@code FileLink}.
+ * @param o2 The second {@code FileLink}.
+ * @return Returns {@code true} if either their local {@code Path}s or remote
+ * paths are equal.
*/
static boolean areEqual(FileLink o1, FileLink o2) {
return isLocalPathEqual(o1, o2) || isRemotePathEqual(o1, o2);
@@ -407,10 +387,8 @@
* Checks whether both {@link FileLink}s return {@code true} when
* {@link #isLocal()} is called and their {@link Path}s are equal.
*
- * @param o1
- * The first {@code FileLink}.
- * @param o2
- * The second {@code FileLink}.
+ * @param o1 The first {@code FileLink}.
+ * @param o2 The second {@code FileLink}.
* @return Returns {@code true} if both {@code FileLink}s have a local
* {@code Path} which are equal.
*/
@@ -422,10 +400,8 @@
* Checks whether both {@link FileLink}s return {@code true} when
* {@link #isRemote()} is called and their remote paths are equal.
*
- * @param o1
- * The first {@code FileLink}.
- * @param o2
- * The second {@code FileLink}.
+ * @param o1 The first {@code FileLink}.
+ * @param o2 The second {@code FileLink}.
* @return Returns {@code true} if both {@code FileLink}s have a remote path
* which are equal.
*/
@@ -470,10 +446,8 @@
/**
* Constructor.
*
- * @param unit
- * The unit.
- * @param prefixChars
- * The prefix characters.
+ * @param unit The unit.
+ * @param prefixChars The prefix characters.
*/
private Format(int unit, String prefixChars) {
this.prefixChars = prefixChars;
@@ -487,8 +461,7 @@
/**
* Formats given file size in bytes into a human readable one.
*
- * @param size
- * The number of bytes.
+ * @param size The number of bytes.
* @return Formatted file size is returned.
*/
private String getSize(long size) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/FilesAttachable.java b/src/main/java/org/eclipse/mdm/api/base/model/FilesAttachable.java
index f8b92c0..43d9aff 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/FilesAttachable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/FilesAttachable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -55,8 +54,7 @@
/**
* Replaces current set of linked files with given {@link FileLink}s.
*
- * @param fileLinks
- * The new {@code FileLink}s.
+ * @param fileLinks The new {@code FileLink}s.
*/
default void setFileLinks(FileLink[] fileLinks) {
getValue(ATTR_FILE_LINKS).set(fileLinks);
@@ -65,8 +63,7 @@
/**
* Adds given {@link FileLink} to the current set of linked files.
*
- * @param fileLink
- * The new {@code FileLink}.
+ * @param fileLink The new {@code FileLink}.
*/
default void addFileLink(FileLink fileLink) {
FileLink[] fileLinks = getFileLinks();
@@ -80,8 +77,7 @@
/**
* Removes given {@link FileLink} from current set of linked files.
*
- * @param fileLink
- * The {@code FileLink} which shall be removed.
+ * @param fileLink The {@code FileLink} which shall be removed.
*/
default void removeFileLink(FileLink fileLink) {
List<FileLink> fileLinks = new ArrayList<>(Arrays.asList(getFileLinks()));
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/FloatComplex.java b/src/main/java/org/eclipse/mdm/api/base/model/FloatComplex.java
index c3d5e53..a8ff102 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/FloatComplex.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/FloatComplex.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -39,10 +38,8 @@
/**
* Constructor.
*
- * @param real
- * The real part.
- * @param imaginary
- * The imaginary part.
+ * @param real The real part.
+ * @param imaginary The imaginary part.
*/
public FloatComplex(float real, float imaginary) {
re = real;
@@ -54,15 +51,13 @@
// ======================================================================
/**
- * Parses given {@code String} where real and imaginary parts are separated
- * by one or more blanks. Furthermore both must be floating point numbers
- * that can be parsed by calling {@link Float#valueOf(String)}.
+ * Parses given {@code String} where real and imaginary parts are separated by
+ * one or more blanks. Furthermore both must be floating point numbers that can
+ * be parsed by calling {@link Float#valueOf(String)}.
*
- * @param s
- * The {@code String} to be parsed.
+ * @param s The {@code String} to be parsed.
* @return The parsed {@link FloatComplex} value is returned.
- * @throws NumberFormatException
- * Thrown if unable to parse the complex value.
+ * @throws NumberFormatException Thrown if unable to parse the complex value.
*/
public static FloatComplex valueOf(String s) {
String[] values = s.split(" +");
@@ -92,8 +87,8 @@
}
/**
- * Returns a human readable {@code String} representation of this complex
- * value. The real and imaginary parts are separated with a blank.
+ * Returns a human readable {@code String} representation of this complex value.
+ * The real and imaginary parts are separated with a blank.
*
* @return The {@code String} representation of this complex value.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Interpolation.java b/src/main/java/org/eclipse/mdm/api/base/model/Interpolation.java
index fc99988..38d6e1e 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Interpolation.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Interpolation.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java b/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
index b12aada..49c6d2e 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/MeasuredValues.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import static java.util.stream.IntStream.range;
@@ -42,16 +41,16 @@
private final boolean[] flags;
/*
- * TODO: - replace name and unit with the corresponding Channel & Unit
- * entities - provide further information if required
- * - provide an overall offset for this value sequence
+ * TODO: - replace name and unit with the corresponding Channel & Unit entities
+ * - provide further information if required - provide an overall offset for
+ * this value sequence
*/
private final String name;
private final String unit;
private final int length;
-
+
private final SequenceRepresentation sequenceRepresentation;
private final double[] generationParameters;
private final boolean independent;
@@ -64,29 +63,23 @@
/**
* Constructor.
*
- * @param scalarType
- * The {@link ScalarType} of this measured values.
- * @param name
- * This is the name of the corresponding {@link Channel}.
- * @param unit
- * Name of the unit the contained values are of.
- * @param sequenceRepresentation
- * The {@link SequenceRepresentation} of the measured values.
- * @param generationParameters
- * The generation parameters for the measured values.
- * @param independent
- * The independent flag of the measured values.
- * @param axisType
- * The {@link AxisType} of the measured values.
- * @param values
- * The measured values.
- * @param flags
- * The validity flags of the measured values.
- * @throws IllegalArgumentException
- * Thrown if values or flags is null or length of values and
- * flags is not equal.
+ * @param scalarType The {@link ScalarType} of this measured values.
+ * @param name This is the name of the corresponding
+ * {@link Channel}.
+ * @param unit Name of the unit the contained values are of.
+ * @param sequenceRepresentation The {@link SequenceRepresentation} of the
+ * measured values.
+ * @param generationParameters The generation parameters for the measured
+ * values.
+ * @param independent The independent flag of the measured values.
+ * @param axisType The {@link AxisType} of the measured values.
+ * @param values The measured values.
+ * @param flags The validity flags of the measured values.
+ * @throws IllegalArgumentException Thrown if values or flags is null or length
+ * of values and flags is not equal.
*/
- MeasuredValues(ScalarType scalarType, String name, String unit, SequenceRepresentation sequenceRepresentation, double[] generationParameters, boolean independent, AxisType axisType, Object values, boolean[] flags) {
+ MeasuredValues(ScalarType scalarType, String name, String unit, SequenceRepresentation sequenceRepresentation,
+ double[] generationParameters, boolean independent, AxisType axisType, Object values, boolean[] flags) {
this.name = name;
this.unit = (unit == null ? "" : unit);
this.scalarType = scalarType;
@@ -145,7 +138,7 @@
public int getLength() {
return length;
}
-
+
/**
* Returns the {@link SequenceRepresentation} of this measured values sequence.
*
@@ -154,7 +147,7 @@
public SequenceRepresentation getSequenceRepresentation() {
return sequenceRepresentation;
}
-
+
/**
* Returns the generation parameters for this measured values sequence.
*
@@ -163,7 +156,7 @@
public double[] getGenerationParameters() {
return generationParameters;
}
-
+
/**
* Returns the independent flag of this measured values sequence.
*
@@ -172,7 +165,7 @@
public boolean isIndependent() {
return independent;
}
-
+
/**
* Returns the {@link AxisType} of this measured values sequence.
*
@@ -194,9 +187,8 @@
* }
* </pre>
*
- * @param <E>
- * This type has to be derived from the {@link ScalarType} of
- * this measured values.
+ * @param <E> This type has to be derived from the {@link ScalarType} of this
+ * measured values.
* @return A typed {@code ValueIterator} is returned.
*/
public <E> ValueIterator<E> iterator() {
@@ -211,10 +203,12 @@
public boolean hasNext() {
return index < length;
}
+
@Override
public boolean isValid() {
return flags[index];
}
+
@Override
@SuppressWarnings("unchecked")
public E next() {
@@ -229,8 +223,8 @@
/**
* Returns a human readable {@code String} representation of this measured
* values. If this sequence contains more than 10 values, only the first and
- * last 5 values are written. If a value is marked as not valid, then 'XX'
- * is written instead of its value.
+ * last 5 values are written. If a value is marked as not valid, then 'XX' is
+ * written instead of its value.
*
* @return The {@code String} representation of this entity.
*/
@@ -266,8 +260,7 @@
/**
* The measured values iterator.
*
- * @param <E>
- * Type of the returned values.
+ * @param <E> Type of the returned values.
* @since 1.0.0
* @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java b/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
index b2ab8ec..6f3183b 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Measurement.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import java.time.LocalDateTime;
@@ -92,8 +91,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Measurement(Core core) {
super(core);
@@ -115,8 +113,7 @@
/**
* Sets new time stamp for the date when this measurement was started.
*
- * @param measurementBegin
- * The new measurement start time stamp.
+ * @param measurementBegin The new measurement start time stamp.
*/
public void setMeasurementBegin(LocalDateTime measurementBegin) {
getValue(ATTR_MEASUREMENT_BEGIN).set(measurementBegin);
@@ -134,19 +131,17 @@
/**
* Sets new time stamp for the date when this measurement was finished.
*
- * @param measurementEnd
- * The new measurement execution end time stamp.
+ * @param measurementEnd The new measurement execution end time stamp.
*/
public void setMeasurementEnd(LocalDateTime measurementEnd) {
getValue(ATTR_MEASUREMENT_END).set(measurementEnd);
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public List<ContextType> loadContextTypes(BaseEntityManager manager)
- throws DataAccessException {
+ public List<ContextType> loadContextTypes(BaseEntityManager manager) throws DataAccessException {
return manager.loadContextTypes(this);
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/MimeType.java b/src/main/java/org/eclipse/mdm/api/base/model/MimeType.java
index 88a9595..04e1df2 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/MimeType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/MimeType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -40,8 +39,7 @@
/**
* Constructor.
*
- * @param mimeType
- * The MIME type will be changed to lower case.
+ * @param mimeType The MIME type will be changed to lower case.
*/
public MimeType(String mimeType) {
internal = mimeType.toLowerCase(Locale.ROOT);
@@ -56,8 +54,8 @@
}
/**
- * Checks whether given {@code MimeType} is either the same as or a sub type
- * of this MIME type. See the following examples:
+ * Checks whether given {@code MimeType} is either the same as or a sub type of
+ * this MIME type. See the following examples:
*
* <pre>
* MimeType type = new MimeType("application/x-asam.aomeasurement");
@@ -68,10 +66,9 @@
* type.isParentOf(type); // true
* </pre>
*
- * @param mimeType
- * The checked type.
- * @return Returns true if either this MIME type and given one are the same
- * or the given one is a sub type of this MIME type.
+ * @param mimeType The checked type.
+ * @return Returns true if either this MIME type and given one are the same or
+ * the given one is a sub type of this MIME type.
*/
public boolean isParentOf(MimeType mimeType) {
return mimeType != null && mimeType.compareString().startsWith(compareString());
@@ -100,8 +97,7 @@
* type.equals(anotherType); // false
* </pre>
*
- * @param object
- * The checked object.
+ * @param object The checked object.
* @return True if given object is of type {@code MimeType} and represents
* exactly the same type as this MIME type.
*/
@@ -129,8 +125,7 @@
// ======================================================================
/**
- * Adds a termination character to the internally stored string
- * representation.
+ * Adds a termination character to the internally stored string representation.
*
* @return A closed comparison string is returned.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Parameter.java b/src/main/java/org/eclipse/mdm/api/base/model/Parameter.java
index 84493b9..97ef271 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Parameter.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Parameter.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -82,8 +81,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Parameter(Core core) {
super(ATTR_SCALAR_TYPE, ATTR_VALUE, core);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ParameterSet.java b/src/main/java/org/eclipse/mdm/api/base/model/ParameterSet.java
index af6d772..fe94c2c 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ParameterSet.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ParameterSet.java
@@ -1,141 +1,136 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.model;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import org.eclipse.mdm.api.base.adapter.Core;
-
-/**
- * Implementation of the parameter set entity type. Instances of this class
- * group a set of further describing data stored in {@link Parameter}s.
- * Parameter sets are attached either to a {@link Measurement} or
- * {@link Channel}.
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
- */
-public class ParameterSet extends BaseEntity implements Deletable {
-
- // ======================================================================
- // Class variables
- // ======================================================================
-
- /**
- * The {@link Measurement} parent type.
- */
- public static final Class<Measurement> PARENT_TYPE_MEASUREMENT = Measurement.class;
-
- /**
- * The {@link ChannelGroup} parent type.
- */
- public static final Class<Channel> PARENT_TYPE_CHANNEL = Channel.class;
-
- /**
- * The 'Version' attribute name.
- */
- public static final String ATTR_VERSION = "Version";
-
- // ======================================================================
- // Constructors
- // ======================================================================
-
- /**
- * Constructor.
- *
- * @param core
- * The {@link Core}.
- */
- ParameterSet(Core core) {
- super(core);
- }
-
- // ======================================================================
- // Public methods
- // ======================================================================
-
- /**
- * Returns the {@link Parameter} identified by given name.
- *
- * @param name
- * The name of the {@code Parameter}.
- * @return The {@code Optional} is empty if a {@code Parameter} with given
- * name does not exist.
- */
- public Optional<Parameter> getParameter(String name) {
- return getParameters().stream().filter(p -> p.nameEquals(name)).findAny();
- }
-
- /**
- * Returns all available {@link Parameter}s related to this parameter set.
- *
- * @return The returned {@code List} is unmodifiable.
- */
- public List<Parameter> getParameters() {
- return getCore().getChildrenStore().get(Parameter.class);
- }
-
- /**
- * Removes the {@link Parameter} identified by given name.
- *
- * @param name
- * Name of the {@code Parameter} that have to be removed.
- * @return Returns {@code true} if the {@code Parameter} with given name has
- * been removed.
- */
- public boolean removeParameter(String name) {
- Optional<Parameter> parameter = getParameter(name);
- if (parameter.isPresent()) {
- getCore().getChildrenStore().remove(parameter.get());
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the version of this parameter set.
- *
- * @return The version is returned.
- */
- public String getVersion() {
- return getValue(ATTR_VERSION).extract();
- }
-
- /**
- * Sets new version for this parameter set.
- *
- * @param version
- * The new version.
- */
- public void setVersion(String version) {
- getValue(ATTR_VERSION).set(version);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
- sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
- return sb.append(", Parameters = ").append(getParameters()).append(')').toString();
- }
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+
+/**
+ * Implementation of the parameter set entity type. Instances of this class
+ * group a set of further describing data stored in {@link Parameter}s.
+ * Parameter sets are attached either to a {@link Measurement} or
+ * {@link Channel}.
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
+ */
+public class ParameterSet extends BaseEntity implements Deletable {
+
+ // ======================================================================
+ // Class variables
+ // ======================================================================
+
+ /**
+ * The {@link Measurement} parent type.
+ */
+ public static final Class<Measurement> PARENT_TYPE_MEASUREMENT = Measurement.class;
+
+ /**
+ * The {@link ChannelGroup} parent type.
+ */
+ public static final Class<Channel> PARENT_TYPE_CHANNEL = Channel.class;
+
+ /**
+ * The 'Version' attribute name.
+ */
+ public static final String ATTR_VERSION = "Version";
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ ParameterSet(Core core) {
+ super(core);
+ }
+
+ // ======================================================================
+ // Public methods
+ // ======================================================================
+
+ /**
+ * Returns the {@link Parameter} identified by given name.
+ *
+ * @param name The name of the {@code Parameter}.
+ * @return The {@code Optional} is empty if a {@code Parameter} with given name
+ * does not exist.
+ */
+ public Optional<Parameter> getParameter(String name) {
+ return getParameters().stream().filter(p -> p.nameEquals(name)).findAny();
+ }
+
+ /**
+ * Returns all available {@link Parameter}s related to this parameter set.
+ *
+ * @return The returned {@code List} is unmodifiable.
+ */
+ public List<Parameter> getParameters() {
+ return getCore().getChildrenStore().get(Parameter.class);
+ }
+
+ /**
+ * Removes the {@link Parameter} identified by given name.
+ *
+ * @param name Name of the {@code Parameter} that have to be removed.
+ * @return Returns {@code true} if the {@code Parameter} with given name has
+ * been removed.
+ */
+ public boolean removeParameter(String name) {
+ Optional<Parameter> parameter = getParameter(name);
+ if (parameter.isPresent()) {
+ getCore().getChildrenStore().remove(parameter.get());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the version of this parameter set.
+ *
+ * @return The version is returned.
+ */
+ public String getVersion() {
+ return getValue(ATTR_VERSION).extract();
+ }
+
+ /**
+ * Sets new version for this parameter set.
+ *
+ * @param version The new version.
+ */
+ public void setVersion(String version) {
+ getValue(ATTR_VERSION).set(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('(');
+ sb.append(getValues().values().stream().map(Value::toString).collect(Collectors.joining(", ")));
+ return sb.append(", Parameters = ").append(getParameters()).append(')').toString();
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/PhysicalDimension.java b/src/main/java/org/eclipse/mdm/api/base/model/PhysicalDimension.java
index 3e43318..5438cbe 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/PhysicalDimension.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/PhysicalDimension.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -82,8 +81,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
PhysicalDimension(Core core) {
super(core);
@@ -105,8 +103,7 @@
/**
* Sets new length exponent for this physical dimension.
*
- * @param exponent
- * The new length exponent.
+ * @param exponent The new length exponent.
*/
public void setLength(Integer exponent) {
getValue(ATTR_LENGTH).set(exponent);
@@ -124,8 +121,7 @@
/**
* Sets new mass exponent for this physical dimension.
*
- * @param exponent
- * The new mass exponent.
+ * @param exponent The new mass exponent.
*/
public void setMass(Integer exponent) {
getValue(ATTR_MASS).set(exponent);
@@ -143,8 +139,7 @@
/**
* Sets new time exponent for this physical dimension.
*
- * @param exponent
- * The new time exponent.
+ * @param exponent The new time exponent.
*/
public void setTime(Integer exponent) {
getValue(ATTR_TIME).set(exponent);
@@ -162,8 +157,7 @@
/**
* Sets new current exponent for this physical dimension.
*
- * @param exponent
- * The new current exponent.
+ * @param exponent The new current exponent.
*/
public void setCurrent(Integer exponent) {
getValue(ATTR_CURRENT).set(exponent);
@@ -181,8 +175,7 @@
/**
* Sets new temperature exponent for this physical dimension.
*
- * @param exponent
- * The new temperature exponent.
+ * @param exponent The new temperature exponent.
*/
public void setTemperature(Integer exponent) {
getValue(ATTR_TEMPERATURE).set(exponent);
@@ -200,8 +193,7 @@
/**
* Sets new molar amount exponent for this physical dimension.
*
- * @param exponent
- * The new molar amount exponent.
+ * @param exponent The new molar amount exponent.
*/
public void setMolarAmount(Integer exponent) {
getValue(ATTR_MOLAR_AMOUNT).set(exponent);
@@ -219,8 +211,7 @@
/**
* Sets new luminous intensity exponent for this physical dimension.
*
- * @param exponent
- * The new luminous intensity exponent.
+ * @param exponent The new luminous intensity exponent.
*/
public void setLuminousIntensity(Integer exponent) {
getValue(ATTR_LUMINOUS_INTENSITY).set(exponent);
@@ -238,8 +229,7 @@
/**
* Sets new angle exponent for this physical dimension.
*
- * @param exponent
- * The new angle exponent.
+ * @param exponent The new angle exponent.
*/
public void setAngle(Integer exponent) {
getValue(ATTR_ANGLE).set(exponent);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Quantity.java b/src/main/java/org/eclipse/mdm/api/base/model/Quantity.java
index 282ed35..9becb0e 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Quantity.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Quantity.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -64,8 +63,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Quantity(Core core) {
super(core);
@@ -87,8 +85,7 @@
/**
* Sets new default rank for this quantity.
*
- * @param defaultRank
- * The new default rank.
+ * @param defaultRank The new default rank.
*/
public void setDefaultRank(Integer defaultRank) {
getValue(ATTR_DEFAULT_RANK).set(defaultRank);
@@ -106,8 +103,7 @@
/**
* Sets new default dimension for this quantity.
*
- * @param defaultDimension
- * The new default dimension.
+ * @param defaultDimension The new default dimension.
*/
public void setDefaultDimension(int[] defaultDimension) {
getValue(ATTR_DEFAULT_DIMENSION).set(defaultDimension);
@@ -125,8 +121,7 @@
/**
* Sets new default type size for this quantity.
*
- * @param defaultTypeSize
- * The new default type size.
+ * @param defaultTypeSize The new default type size.
*/
public void setDefaultTypeSize(Integer defaultTypeSize) {
getValue(ATTR_DEFAULT_TYPE_SIZE).set(defaultTypeSize);
@@ -144,8 +139,7 @@
/**
* Sets new default {@link Channel} name for this quantity.
*
- * @param defaultChannelName
- * The new default {@code Channel} name.
+ * @param defaultChannelName The new default {@code Channel} name.
*/
public void setDefaultChannelName(String defaultChannelName) {
getValue(ATTR_DEFAULT_CHANNEL_NAME).set(defaultChannelName);
@@ -163,11 +157,9 @@
/**
* Sets new default {@link ScalarType} for this quantity.
*
- * @param defaultScalarType
- * The new default {@code ScalarType}.
- * @throws IllegalArgumentException
- * Thrown if given {@code ScalarType} is
- * {@link ScalarType#UNKNOWN}.
+ * @param defaultScalarType The new default {@code ScalarType}.
+ * @throws IllegalArgumentException Thrown if given {@code ScalarType} is
+ * {@link ScalarType#UNKNOWN}.
*/
public void setDefaultScalarType(ScalarType defaultScalarType) {
if (defaultScalarType.isUnknown()) {
@@ -190,8 +182,7 @@
/**
* Sets new default {@link Unit} for this quantity.
*
- * @param defaultUnit
- * The new default {@code Unit}.
+ * @param defaultUnit The new default {@code Unit}.
*/
public void setDefaultUnit(Unit defaultUnit) {
getCore().getMutableStore().set(defaultUnit);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java b/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
index a13775e..03bc8ba 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ScalarType.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import java.lang.reflect.Array;
@@ -89,7 +88,8 @@
* A {@link MeasuredValues} with this type contains an array sequence of
* {@code byte[]} values.
*/
- public static final ScalarType BYTE_STREAM = new ScalarType(9, "BYTE_STREAM", ValueType.BYTE_STREAM_SEQUENCE, byte[].class);
+ public static final ScalarType BYTE_STREAM = new ScalarType(9, "BYTE_STREAM", ValueType.BYTE_STREAM_SEQUENCE,
+ byte[].class);
/**
* A {@link MeasuredValues} with this type contains an array sequence of
@@ -102,12 +102,12 @@
* A {@link MeasuredValues} with this type contains an array sequence of
* {@code DoubleComplex} values.
*/
- public static final ScalarType DOUBLE_COMPLEX = new ScalarType(11, "DOUBLE_COMPLEX", ValueType.DOUBLE_COMPLEX_SEQUENCE,
- DoubleComplex.class);
+ public static final ScalarType DOUBLE_COMPLEX = new ScalarType(11, "DOUBLE_COMPLEX",
+ ValueType.DOUBLE_COMPLEX_SEQUENCE, DoubleComplex.class);
/**
- * {@link MeasuredValues} are not allowed to be of this type. This constant
- * may be used in other contexts.
+ * {@link MeasuredValues} are not allowed to be of this type. This constant may
+ * be used in other contexts.
*/
public static final ScalarType ENUMERATION = new ScalarType(12, "ENUMERATION", ValueType.ENUMERATION_SEQUENCE);
@@ -115,7 +115,8 @@
* A {@link MeasuredValues} with this type contains an array sequence of
* {@code FileLink} values.
*/
- public static final ScalarType FILE_LINK = new ScalarType(13, "FILE_LINK", ValueType.FILE_LINK_SEQUENCE, FileLink.class);
+ public static final ScalarType FILE_LINK = new ScalarType(13, "FILE_LINK", ValueType.FILE_LINK_SEQUENCE,
+ FileLink.class);
/**
* TODO ...
@@ -123,8 +124,8 @@
public static final ScalarType BLOB = new ScalarType(14, "BLOB", ValueType.BLOB, Object.class);
/**
- * {@link MeasuredValues} are not allowed to be of this type. This constant
- * may be used in other contexts.
+ * {@link MeasuredValues} are not allowed to be of this type. This constant may
+ * be used in other contexts.
*/
public static final ScalarType UNKNOWN = new ScalarType(15, "UNKNOWN", ValueType.UNKNOWN);
@@ -134,12 +135,9 @@
/**
* Constructor.
*
- * @param ord
- * ordinal number of the enum value
- * @param name
- * name of the enum value
- * @param valueType
- * The associated {@link ValueType}.
+ * @param ord ordinal number of the enum value
+ * @param name name of the enum value
+ * @param valueType The associated {@link ValueType}.
*/
private ScalarType(int ord, String name, ValueType valueType) {
super(name, ord);
@@ -150,15 +148,11 @@
/**
* Constructor.
*
- * @param ord
- * ordinal number of the enum value
- * @param name
- * name of the enum value
- * @param valueType
- * The associated {@link ValueType}.
- * @param componentType
- * The component type of the array held by instances of
- * {@link MeasuredValues}.
+ * @param ord ordinal number of the enum value
+ * @param name name of the enum value
+ * @param valueType The associated {@link ValueType}.
+ * @param componentType The component type of the array held by instances of
+ * {@link MeasuredValues}.
*/
private ScalarType(int ord, String name, ValueType valueType, Class<?> componentType) {
super(name, ord);
@@ -167,38 +161,34 @@
}
/**
- * Creates a new {@link MeasuredValues} initialized with given name, unit
- * and values including the related validity flags.
+ * Creates a new {@link MeasuredValues} initialized with given name, unit and
+ * values including the related validity flags.
*
- * @param name
- * This is the name of the corresponding {@link Channel}.
- * @param unit
- * Name of the unit the contained values are of.
- * @param sequenceRepresentation
- * The {@link SequenceRepresentation} of the measured values.
- * @param independent
- * The independent flag of the measured values.
- * @param axisType
- * The {@link AxisType} of the measured values.
- * @param input
- * The measured values.
- * @param flags
- * The validity flags of the measured values.
+ * @param name This is the name of the corresponding
+ * {@link Channel}.
+ * @param unit Name of the unit the contained values are of.
+ * @param sequenceRepresentation The {@link SequenceRepresentation} of the
+ * measured values.
+ * @param independent The independent flag of the measured values.
+ * @param axisType The {@link AxisType} of the measured values.
+ * @param input The measured values.
+ * @param flags The validity flags of the measured values.
* @return The created {@code MeasuredValues} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumeration()} or {@link #isUnknown()}
- * returns {@code true}.
- * @throws IllegalArgumentException
- * Thrown if given values are not assignment compatible.
+ * @throws IllegalStateException Thrown if {@link #isEnumeration()} or
+ * {@link #isUnknown()} returns {@code true}.
+ * @throws IllegalArgumentException Thrown if given values are not assignment
+ * compatible.
*/
- public MeasuredValues createMeasuredValues(String name, String unit, SequenceRepresentation sequenceRepresentation, double[] generationParameters, boolean independent, AxisType axisType, Object input, boolean[] flags) {
+ public MeasuredValues createMeasuredValues(String name, String unit, SequenceRepresentation sequenceRepresentation,
+ double[] generationParameters, boolean independent, AxisType axisType, Object input, boolean[] flags) {
if (isEnumeration() || isUnknown()) {
throw new IllegalStateException("It is not allowed to create measured values of type '" + this + "'.");
} else if (!arrayType.isInstance(input)) {
throw new IllegalArgumentException("Given values of type '" + input.getClass() + "'.");
}
- return new MeasuredValues(this, name, unit, sequenceRepresentation, generationParameters, independent, axisType, input, flags);
+ return new MeasuredValues(this, name, unit, sequenceRepresentation, generationParameters, independent, axisType,
+ input, flags);
}
/**
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/SequenceRepresentation.java b/src/main/java/org/eclipse/mdm/api/base/model/SequenceRepresentation.java
index afe3f42..e59b8b2 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/SequenceRepresentation.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/SequenceRepresentation.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -44,9 +43,9 @@
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
- * p<sub>1</sub>+(i-1)*p<sub>2</sub> for i ∈ [1, n], n is the total
- * number of values and generation parameters p<sub>1</sub> (start value)
- * and p<sub>2</sub> (increment).
+ * p<sub>1</sub>+(i-1)*p<sub>2</sub> for i ∈ [1, n], n is the total number
+ * of values and generation parameters p<sub>1</sub> (start value) and
+ * p<sub>2</sub> (increment).
*/
public static final SequenceRepresentation IMPLICIT_LINEAR = new SequenceRepresentation("IMPLICIT_LINEAR", 2);
@@ -54,17 +53,17 @@
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
* p<sub>1</sub>+((i-1)mod(p<sub>3</sub>-p<sub>1</sub>)/p<sub>2</sub>)*
* p<sub>2</sub> for i ∈ [1, n], n is the total number of values and
- * generation parameters p<sub>1</sub> (start value), p<sub>2</sub>
- * (increment) and p<sub>3</sub> (number of values per saw). The expression
- * (p<sub>3</sub>-p<sub>1</sub>)/p<sub>2</sub> must be truncated to integer
- * to start each saw curve cycle at p<sub>1</sub>.
+ * generation parameters p<sub>1</sub> (start value), p<sub>2</sub> (increment)
+ * and p<sub>3</sub> (number of values per saw). The expression
+ * (p<sub>3</sub>-p<sub>1</sub>)/p<sub>2</sub> must be truncated to integer to
+ * start each saw curve cycle at p<sub>1</sub>.
*/
public static final SequenceRepresentation IMPLICIT_SAW = new SequenceRepresentation("IMPLICIT_SAW", 3);
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
- * p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub> for i ∈ [1, n], n is the
- * total number of values and generation parameters p<sub>1</sub> (offset),
+ * p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub> for i ∈ [1, n], n is the total
+ * number of values and generation parameters p<sub>1</sub> (offset),
* p<sub>2</sub> (factor) and the raw value r at position i.
*/
public static final SequenceRepresentation RAW_LINEAR = new SequenceRepresentation("RAW_LINEAR", 4);
@@ -72,10 +71,10 @@
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> = ∑
* p<sub>j</sub>*r<sub>i</sub><sup>j-1</sup> = p<sub>2</sub>+p<sub>3
- * </sub>*r<sub>i</sub>+p<sub>4</sub>*r<sub>i</sub><sup>2</sup>+... for i
- * ∈ [1, n], n is the total number of values and generation parameters
- * p<sub>j</sub> for j ∈ [1, p<sub>1</sub>] and the raw value r at
- * position i.
+ * </sub>*r<sub>i</sub>+p<sub>4</sub>*r<sub>i</sub><sup>2</sup>+... for i ∈
+ * [1, n], n is the total number of values and generation parameters
+ * p<sub>j</sub> for j ∈ [1, p<sub>1</sub>] and the raw value r at position
+ * i.
*/
public static final SequenceRepresentation RAW_POLYNOMIAL = new SequenceRepresentation("RAW_POLYNOMIAL", 5);
@@ -83,50 +82,53 @@
* Not used. But keep here to show ordinal sequence.
*/
public static final SequenceRepresentation FORMULA = new SequenceRepresentation("FORMULA", 6);
-
+
/**
- * Measured values are stored as is in an external file and values are
- * therefore immediately available.
+ * Measured values are stored as is in an external file and values are therefore
+ * immediately available.
*/
public static final SequenceRepresentation EXPLICIT_EXTERNAL = new SequenceRepresentation("EXPLICIT_EXTERNAL", 7);
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
- * p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub> for i ∈ [1, n], n is the
- * total number of values and generation parameters p<sub>1</sub> (offset),
+ * p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub> for i ∈ [1, n], n is the total
+ * number of values and generation parameters p<sub>1</sub> (offset),
* p<sub>2</sub> (factor) and the raw value r at position i read from an
* external file.
*/
- public static final SequenceRepresentation RAW_LINEAR_EXTERNAL = new SequenceRepresentation("RAW_LINEAR_EXTERNAL", 8);
+ public static final SequenceRepresentation RAW_LINEAR_EXTERNAL = new SequenceRepresentation("RAW_LINEAR_EXTERNAL",
+ 8);
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> = ∑
* p<sub>j</sub>*r<sub>i</sub><sup>j-1</sup> = p<sub>2</sub>+p<sub>3
- * </sub>*r<sub>i</sub>+p<sub>4</sub>*r<sub>i</sub><sup>2</sup>+... for i
- * ∈ [1, n], n is the total number of values and generation parameters
- * p<sub>j</sub> for j ∈ [1, p<sub>1</sub>] and the raw value r at
- * position i read from an external file.
+ * </sub>*r<sub>i</sub>+p<sub>4</sub>*r<sub>i</sub><sup>2</sup>+... for i ∈
+ * [1, n], n is the total number of values and generation parameters
+ * p<sub>j</sub> for j ∈ [1, p<sub>1</sub>] and the raw value r at position
+ * i read from an external file.
*/
- public static final SequenceRepresentation RAW_POLYNOMIAL_EXTERNAL = new SequenceRepresentation("RAW_POLYNOMIAL_EXTERNAL", 9);
+ public static final SequenceRepresentation RAW_POLYNOMIAL_EXTERNAL = new SequenceRepresentation(
+ "RAW_POLYNOMIAL_EXTERNAL", 9);
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
- * (p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub>)*p<sub>3</sub> for i ∈
- * [1, n], n is the total number of values and generation parameters
- * p<sub>1</sub> (offset), p<sub>2</sub> (factor), p<sub>2</sub>
- * (calibration) and the raw value r at position i.
+ * (p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub>)*p<sub>3</sub> for i ∈ [1,
+ * n], n is the total number of values and generation parameters p<sub>1</sub>
+ * (offset), p<sub>2</sub> (factor), p<sub>2</sub> (calibration) and the raw
+ * value r at position i.
*/
- public static final SequenceRepresentation RAW_LINEAR_CALIBRATED = new SequenceRepresentation("RAW_LINEAR_CALIBRATED", 10);
+ public static final SequenceRepresentation RAW_LINEAR_CALIBRATED = new SequenceRepresentation(
+ "RAW_LINEAR_CALIBRATED", 10);
/**
* Each value x<sub>i</sub> is generated as follows: x<sub>i</sub> =
- * (p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub>)*p<sub>3</sub> for i ∈
- * [1, n], n is the total number of values and generation parameters
- * p<sub>1</sub> (offset), p<sub>2</sub> (factor), p<sub>2</sub>
- * (calibration) and the raw value r at position i read from an external
- * file.
+ * (p<sub>1</sub>+p<sub>2</sub>*r<sub>i</sub>)*p<sub>3</sub> for i ∈ [1,
+ * n], n is the total number of values and generation parameters p<sub>1</sub>
+ * (offset), p<sub>2</sub> (factor), p<sub>2</sub> (calibration) and the raw
+ * value r at position i read from an external file.
*/
- public static final SequenceRepresentation RAW_LINEAR_CALIBRATED_EXTERNAL = new SequenceRepresentation("RAW_LINEAR_CALIBRATED_EXTERNAL", 11);
+ public static final SequenceRepresentation RAW_LINEAR_CALIBRATED_EXTERNAL = new SequenceRepresentation(
+ "RAW_LINEAR_CALIBRATED_EXTERNAL", 11);
private SequenceRepresentation(String name, int ordinal) {
super(name, ordinal);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Sortable.java b/src/main/java/org/eclipse/mdm/api/base/model/Sortable.java
index 404415e..f49d2a5 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Sortable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Sortable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -34,9 +33,9 @@
// ======================================================================
/**
- * This {@code Comparator} compares entities implementing the
- * {@link Sortable} interface by the mandatory {@link #ATTR_SORT_INDEX}
- * property in ascending order.
+ * This {@code Comparator} compares entities implementing the {@link Sortable}
+ * interface by the mandatory {@link #ATTR_SORT_INDEX} property in ascending
+ * order.
*/
Comparator<Sortable> COMPARATOR = Comparator.comparing(Sortable::getSortIndex);
@@ -61,8 +60,7 @@
/**
* Sets new sort index for this entity.
*
- * @param sortIndex
- * The new sort index.
+ * @param sortIndex The new sort index.
*/
default void setSortIndex(Integer sortIndex) {
getValue(ATTR_SORT_INDEX).set(sortIndex);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/StatusAttachable.java b/src/main/java/org/eclipse/mdm/api/base/model/StatusAttachable.java
index 328e247..6856807 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/StatusAttachable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/StatusAttachable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Tagable.java b/src/main/java/org/eclipse/mdm/api/base/model/Tagable.java
index 21d5111..186d582 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Tagable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Tagable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Test.java b/src/main/java/org/eclipse/mdm/api/base/model/Test.java
index f8fdf92..2e8b342 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Test.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Test.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -54,8 +53,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Test(Core core) {
super(core);
@@ -78,8 +76,7 @@
/**
* Sets new {@link User} as the responsible person for this test.
*
- * @param responsiblePerson
- * The new responsible person.
+ * @param responsiblePerson The new responsible person.
*/
public void setResponsiblePerson(User responsiblePerson) {
getCore().getMutableStore().set(responsiblePerson);
@@ -88,10 +85,9 @@
/**
* Returns the commissioned {@link TestStep} identified by given name.
*
- * @param name
- * The name of the {@code TestStep}.
- * @return The {@code Optional} is empty if a {@code TestStep} with given
- * name does not exist.
+ * @param name The name of the {@code TestStep}.
+ * @return The {@code Optional} is empty if a {@code TestStep} with given name
+ * does not exist.
*/
public Optional<TestStep> getCommissionedTestStep(String name) {
return getCommissionedTestSteps().stream().filter(ts -> ts.nameEquals(name)).findAny();
@@ -109,10 +105,9 @@
/**
* Removes the commissioned {@link TestStep} identified by given name.
*
- * @param name
- * Name of the {@code TestStep} that has to be removed.
- * @return Returns {@code true} if the {@code TestStep} with given name has
- * been removed.
+ * @param name Name of the {@code TestStep} that has to be removed.
+ * @return Returns {@code true} if the {@code TestStep} with given name has been
+ * removed.
*/
public boolean removeCommissionedTestStep(String name) {
Optional<TestStep> testStep = getCommissionedTestStep(name);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java b/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
index 9f42915..9b54bd3 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/TestStep.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import java.util.HashMap;
@@ -69,8 +68,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
TestStep(Core core) {
super(core);
@@ -92,8 +90,7 @@
/**
* Sets new optional flag for this test step.
*
- * @param optional
- * The new optional flag.
+ * @param optional The new optional flag.
*/
public void setOptional(Boolean optional) {
getValue(ATTR_OPTIONAL).set(optional);
@@ -103,8 +100,7 @@
* {@inheritDoc}
*/
@Override
- public List<ContextType> loadContextTypes(BaseEntityManager manager)
- throws DataAccessException {
+ public List<ContextType> loadContextTypes(BaseEntityManager manager) throws DataAccessException {
return manager.loadContextTypes(this);
}
@@ -112,11 +108,11 @@
* {@inheritDoc}
*/
@Override
- public Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager,
- ContextType... contextTypes) throws DataAccessException {
-
+ public Map<ContextType, ContextRoot> loadContexts(BaseEntityManager manager, ContextType... contextTypes)
+ throws DataAccessException {
+
Map<ContextType, ContextRoot> map = new HashMap<>();
-
+
for (ContextType contextType : contextTypes) {
ContextRoot c = getCore().getMutableStore().get(ContextRoot.class, contextType);
if (c != null) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/TypeSpecification.java b/src/main/java/org/eclipse/mdm/api/base/model/TypeSpecification.java
index 77e185e..80e8246 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/TypeSpecification.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/TypeSpecification.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -95,7 +94,8 @@
public static final TypeSpecification BIT_UNSIGNED_INTEGER = new TypeSpecification("BIT_UNSIGNED_INTEGER", 29);
// BIT_UINT_BEO,
- public static final TypeSpecification BIT_UNSIGNED_INTEGER_BEO = new TypeSpecification("BIT_UNSIGNED_INTEGER_BEO", 30);
+ public static final TypeSpecification BIT_UNSIGNED_INTEGER_BEO = new TypeSpecification("BIT_UNSIGNED_INTEGER_BEO",
+ 30);
public static final TypeSpecification BIT_FLOAT = new TypeSpecification("BIT_FLOAT", 31);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Unit.java b/src/main/java/org/eclipse/mdm/api/base/model/Unit.java
index dd73025..b64fd7c 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Unit.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Unit.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -60,8 +59,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
Unit(Core core) {
super(core);
@@ -83,8 +81,7 @@
/**
* Sets new factor for this unit.
*
- * @param factor
- * The new factor.
+ * @param factor The new factor.
*/
public void setFactor(Double factor) {
getValue(ATTR_FACTOR).set(factor);
@@ -102,8 +99,7 @@
/**
* Sets new offset for this unit.
*
- * @param offset
- * The new offset.
+ * @param offset The new offset.
*/
public void setOffset(Double offset) {
getValue(ATTR_OFFSET).set(offset);
@@ -123,9 +119,8 @@
/**
* Returns the factor, which allows to convert the decibel values back into
- * linear values. If the decibel flag is set to false, this method should
- * return 0, which is described in the ASAM NVH specification (Chapter 11,
- * 10.3).
+ * linear values. If the decibel flag is set to false, this method should return
+ * 0, which is described in the ASAM NVH specification (Chapter 11, 10.3).
*
* @return The decibel reference factor is returned.
* @see #isDB()
@@ -138,11 +133,10 @@
* Changes the decibel status of this unit. The decibel flag is deduced from
* given reference factor. If the reference factor is finite, as returned by
* {@link Float#isFinite(float)}, and not 0, then the decibel flag is set to
- * true and given reference factor is taken. In any other case both, the
- * decibel flag and the reference factor, will be reset.
+ * true and given reference factor is taken. In any other case both, the decibel
+ * flag and the reference factor, will be reset.
*
- * @param dbReferenceFactor
- * The new decibel reference factor.
+ * @param dbReferenceFactor The new decibel reference factor.
*/
public void setDB(Float dbReferenceFactor) {
boolean isValid = Float.isFinite(dbReferenceFactor) && Float.compare(Math.abs(dbReferenceFactor), 0F) != 0;
@@ -167,8 +161,7 @@
/**
* Sets new {@link PhysicalDimension} for this unit.
*
- * @param physicalDimension
- * The new {@code PhysicalDimension}.
+ * @param physicalDimension The new {@code PhysicalDimension}.
*/
public void setPhysicalDimension(PhysicalDimension physicalDimension) {
getCore().getMutableStore().set(physicalDimension);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/User.java b/src/main/java/org/eclipse/mdm/api/base/model/User.java
index bb6d545..a0cff2d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/User.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/User.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -62,8 +61,7 @@
/**
* Constructor.
*
- * @param core
- * The {@link Core}.
+ * @param core The {@link Core}.
*/
User(Core core) {
super(core);
@@ -85,8 +83,7 @@
/**
* Sets new given name for this user.
*
- * @param givenName
- * The new given name.
+ * @param givenName The new given name.
*/
public void setGivenName(String givenName) {
getValue(ATTR_GIVEN_NAME).set(givenName);
@@ -104,8 +101,7 @@
/**
* Sets new surname for this user.
*
- * @param surname
- * The new surname.
+ * @param surname The new surname.
*/
public void setSurname(String surname) {
getValue(ATTR_SURNAME).set(surname);
@@ -123,8 +119,7 @@
/**
* Sets new department for this user.
*
- * @param department
- * The new department.
+ * @param department The new department.
*/
public void setDepartment(String department) {
getValue(ATTR_DEPARTMENT).set(department);
@@ -142,8 +137,7 @@
/**
* Sets new phone number for this user.
*
- * @param phone
- * The new phone number.
+ * @param phone The new phone number.
*/
public void setPhone(String phone) {
getValue(ATTR_PHONE).set(phone);
@@ -161,8 +155,7 @@
/**
* Sets new e-mail address for this user.
*
- * @param eMail
- * The new e-mail address.
+ * @param eMail The new e-mail address.
*/
public void setMail(String eMail) {
getValue(ATTR_EMAIL).set(eMail);
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/Value.java b/src/main/java/org/eclipse/mdm/api/base/model/Value.java
index 5ba91d3..a23ae6a 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/Value.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/Value.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -64,20 +63,13 @@
/**
* Constructor.
*
- * @param valueType
- * The associated {@link ValueType}.
- * @param name
- * The name of this container.
- * @param unit
- * The name of the unit.
- * @param valid
- * The initial validity flag.
- * @param value
- * The initial value.
- * @param valueClass
- * Used for type checking upon assignment.
- * @param defaultValue
- * Used as null replacement.
+ * @param valueType The associated {@link ValueType}.
+ * @param name The name of this container.
+ * @param unit The name of the unit.
+ * @param valid The initial validity flag.
+ * @param value The initial value.
+ * @param valueClass Used for type checking upon assignment.
+ * @param defaultValue Used as null replacement.
*/
Value(ValueType<?> valueType, String name, String unit, boolean valid, Object value, Class<?> valueClass,
Object defaultValue, String valueTypeDescr) {
@@ -102,10 +94,8 @@
/**
* Constructor.
*
- * @param origin
- * The origin {@link Value}.
- * @param input
- * The new value.
+ * @param origin The origin {@link Value}.
+ * @param input The new value.
*/
private Value(Value origin, Object input) {
this(origin.valueType, origin.name, origin.unit, origin.valid, input, origin.valueClass, origin.defaultValue,
@@ -165,8 +155,7 @@
/**
* Overwrites validity flag with given flag.
*
- * @param valid
- * The new validity flag.
+ * @param valid The new validity flag.
*/
public void setValid(boolean valid) {
this.valid = valid;
@@ -175,10 +164,8 @@
/**
* Returns currently stored value of this value container.
*
- * @param <T>
- * The expected value type.
- * @param type
- * The {@link ValueType}.
+ * @param <T> The expected value type.
+ * @param type The {@link ValueType}.
* @return Currently stored value is returned.
*/
@SuppressWarnings("unchecked")
@@ -189,8 +176,7 @@
/**
* Returns currently stored value of this value container.
*
- * @param <T>
- * The expected value type.
+ * @param <T> The expected value type.
* @return Currently stored value is returned.
*/
@SuppressWarnings("unchecked")
@@ -199,16 +185,14 @@
}
/**
- * Replaces currently stored value with the given one. If {@code null} is
- * given, then a well defined default value is used instead and the validity
- * flag is automatically set to {@code false}.
+ * Replaces currently stored value with the given one. If {@code null} is given,
+ * then a well defined default value is used instead and the validity flag is
+ * automatically set to {@code false}.
*
- * @param input
- * The new value must be an instance of the type defined in
- * {@link ValueType#type} or in case of an enumeration type an
- * appropriate enumeration constant or array thereof.
- * @throws IllegalArgumentException
- * Thrown if an incompatible value is given.
+ * @param input The new value must be an instance of the type defined in
+ * {@link ValueType#type} or in case of an enumeration type an
+ * appropriate enumeration constant or array thereof.
+ * @throws IllegalArgumentException Thrown if an incompatible value is given.
*/
public void set(Object input) {
if (input == null) {
@@ -227,16 +211,15 @@
/**
* Merges given value container with this instance. To be able to do so, the
- * given value container must be compatible with this one. Value containers
- * are compatible if the their name, unit and {@link ValueType} is equal. If
- * the stored values or the validity flags do not match, then both values
- * are discarded and {@code null} is taken as the initial value.
+ * given value container must be compatible with this one. Value containers are
+ * compatible if the their name, unit and {@link ValueType} is equal. If the
+ * stored values or the validity flags do not match, then both values are
+ * discarded and {@code null} is taken as the initial value.
*
- * @param value
- * The value container that will be merged with this instance.
+ * @param value The value container that will be merged with this instance.
* @return A new value container with merged value is returned.
- * @throws IllegalArgumentException
- * Thrown if given value container is not compatible.
+ * @throws IllegalArgumentException Thrown if given value container is not
+ * compatible.
*/
public Value merge(Value value) {
boolean nameMissmatch = !getName().equals(value.getName());
@@ -253,6 +236,7 @@
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
@@ -266,33 +250,31 @@
Value val = (Value) other;
- return Objects.equals(this.valueType, val.valueType)
- && Objects.equals(this.name, val.name)
- && Objects.equals(this.unit, val.unit)
- && Objects.equals(this.initialValid, val.initialValid)
- && Objects.deepEquals(this.initialValue, val.initialValue)
- && Objects.equals(this.valid, val.valid)
- && Objects.deepEquals(this.value, val.value)
- && Objects.equals(this.valueClass, val.valueClass)
+ return Objects.equals(this.valueType, val.valueType) && Objects.equals(this.name, val.name)
+ && Objects.equals(this.unit, val.unit) && Objects.equals(this.initialValid, val.initialValid)
+ && Objects.deepEquals(this.initialValue, val.initialValue) && Objects.equals(this.valid, val.valid)
+ && Objects.deepEquals(this.value, val.value) && Objects.equals(this.valueClass, val.valueClass)
&& Objects.equals(this.valueTypeDescr, val.valueTypeDescr)
&& Objects.equals(this.defaultValue, val.defaultValue);
}
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
- return Objects.hash(valueType, name, unit, initialValid, initialValue, valid, value, valueClass, valueTypeDescr, defaultValue);
+ return Objects.hash(valueType, name, unit, initialValid, initialValue, valid, value, valueClass, valueTypeDescr,
+ defaultValue);
}
-
+
/**
- * Returns a human readable {@code String} representation of this value. In
- * case of a sequence value container with up to 10 values the complete
- * sequence will be printed. Otherwise only the 5 first and last values will
- * be printed. If the contained value is marked as not valid, then the
- * contained value is omitted in the representation.
+ * Returns a human readable {@code String} representation of this value. In case
+ * of a sequence value container with up to 10 values the complete sequence will
+ * be printed. Otherwise only the 5 first and last values will be printed. If
+ * the contained value is marked as not valid, then the contained value is
+ * omitted in the representation.
*
* @return The {@code String} representation of this value.
*/
@@ -327,8 +309,8 @@
}
/**
- * Checks whether either the validity flag or the value have been modified
- * since initialization.
+ * Checks whether either the validity flag or the value have been modified since
+ * initialization.
*
* @return Returns {@code true} either if the flag or the value has been
* modified.
@@ -362,7 +344,7 @@
initialValid = isValid();
initialValue = copy(extract());
}
-
+
// ======================================================================
// Package methods
// ======================================================================
@@ -370,10 +352,8 @@
/**
* Returns the {@code String} value from given array at given position.
*
- * @param array
- * The array {@code Object}.
- * @param index
- * The index of the required value.
+ * @param array The array {@code Object}.
+ * @param index The index of the required value.
* @return The {@code String} value of the requested value is returned.
*/
static String readAt(Object array, int index) {
@@ -390,11 +370,10 @@
// ======================================================================
/**
- * Returns a copy of given {@code Object}, so modifications in one do not
- * affect to other.
+ * Returns a copy of given {@code Object}, so modifications in one do not affect
+ * to other.
*
- * @param value
- * The object which will be copied.
+ * @param value The object which will be copied.
* @return The copy is returned.
*/
private static Object copy(Object value) {
@@ -412,15 +391,13 @@
// simple immutable value
return value;
}
-
+
/**
* Replaces currently stored value with the given one.
*
- * @param input
- * The new value must be an instance of the enumeration type
- * an appropriate enumeration constant.
- * @throws IllegalArgumentException
- * Thrown if an incompatible value is given.
+ * @param input The new value must be an instance of the enumeration type an
+ * appropriate enumeration constant.
+ * @throws IllegalArgumentException Thrown if an incompatible value is given.
*/
private void setForEnumerationValue(Object input) {
String inpvalueTypeDescr = ((EnumerationValue) input).getOwner().getName();
@@ -447,10 +424,8 @@
* Returns a deep copy of given {@code Object}, so modifications in one do not
* affect to other.
*
- * @param value
- * The object which will be copied.
- * @param valueClass
- * The class of the value object.
+ * @param value The object which will be copied.
+ * @param valueClass The class of the value object.
* @return The copy is returned.
*/
private static Object createDeepCopy(Object value, Class<?> valueClass) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/ValueType.java b/src/main/java/org/eclipse/mdm/api/base/model/ValueType.java
index c15b83f..31db786 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/ValueType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/ValueType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -29,8 +28,8 @@
public class ValueType<T> extends EnumerationValue {
/**
- * A {@link Value} with this type contains a {@code String} value and
- * replaces {@code null} with an empty {@code String}.
+ * A {@link Value} with this type contains a {@code String} value and replaces
+ * {@code null} with an empty {@code String}.
*/
public static final ValueType<String> STRING = new ValueType<>(String.class, "STRING", "");
@@ -38,7 +37,8 @@
* A {@link Value} with this type contains a {@code String[]} value replaces
* {@code null} with an empty {@code String} array.
*/
- public static final ValueType<String[]> STRING_SEQUENCE = new ValueType<>(String[].class, "STRING_SEQUENCE", new String[0]);
+ public static final ValueType<String[]> STRING_SEQUENCE = new ValueType<>(String[].class, "STRING_SEQUENCE",
+ new String[0]);
/**
* A {@link Value} with this type contains a {@link LocalDateTime} value and
@@ -47,14 +47,15 @@
public static final ValueType<LocalDateTime> DATE = new ValueType<>(LocalDateTime.class, "DATE", null);
/**
- * A {@link Value} with this type contains a {@code LocalDateTime[]} value
- * and replaces {@code null} with an empty {@code LocalDateTime} array.
+ * A {@link Value} with this type contains a {@code LocalDateTime[]} value and
+ * replaces {@code null} with an empty {@code LocalDateTime} array.
*/
- public static final ValueType<LocalDateTime[]> DATE_SEQUENCE = new ValueType<>(LocalDateTime[].class, "DATE_SEQUENCE", new LocalDateTime[0]);
+ public static final ValueType<LocalDateTime[]> DATE_SEQUENCE = new ValueType<>(LocalDateTime[].class,
+ "DATE_SEQUENCE", new LocalDateTime[0]);
/**
- * A {@link Value} with this type contains a {@link Boolean} value and
- * replaces {@code null} with {@link Boolean#FALSE}.
+ * A {@link Value} with this type contains a {@link Boolean} value and replaces
+ * {@code null} with {@link Boolean#FALSE}.
*/
public static final ValueType<Boolean> BOOLEAN = new ValueType<>(Boolean.class, "BOOLEAN", Boolean.FALSE);
@@ -62,7 +63,8 @@
* A {@link Value} with this type contains a {@code boolean[]} value and
* replaces {@code null} with an empty {@code boolean} array.
*/
- public static final ValueType<boolean[]> BOOLEAN_SEQUENCE = new ValueType<>(boolean[].class, "BOOLEAN_SEQUENCE", new boolean[0]);
+ public static final ValueType<boolean[]> BOOLEAN_SEQUENCE = new ValueType<>(boolean[].class, "BOOLEAN_SEQUENCE",
+ new boolean[0]);
/**
* A {@link Value} with this type contains a {@link Byte} value and replaces
@@ -71,34 +73,36 @@
public static final ValueType<Byte> BYTE = new ValueType<>(Byte.class, "BYTE", Byte.valueOf((byte) 0));
/**
- * A {@link Value} with this type contains a {@code byte[]} value and
- * replaces {@code null} with an empty {@code byte} array.
+ * A {@link Value} with this type contains a {@code byte[]} value and replaces
+ * {@code null} with an empty {@code byte} array.
*/
public static final ValueType<byte[]> BYTE_SEQUENCE = new ValueType<>(byte[].class, "BYTE_SEQUENCE", new byte[0]);
/**
- * A {@link Value} with this type contains a {@link Short} value and
- * replaces {@code null} with a {@code Short} containing zero.
+ * A {@link Value} with this type contains a {@link Short} value and replaces
+ * {@code null} with a {@code Short} containing zero.
*/
public static final ValueType<Short> SHORT = new ValueType<>(Short.class, "SHORT", Short.valueOf((short) 0));
/**
- * A {@link Value} with this type contains a {@code short[]} value and
- * replaces {@code null} with an empty {@code short} array.
+ * A {@link Value} with this type contains a {@code short[]} value and replaces
+ * {@code null} with an empty {@code short} array.
*/
- public static final ValueType<short[]> SHORT_SEQUENCE = new ValueType<>(short[].class, "SHORT_SEQUENCE", new short[0]);
+ public static final ValueType<short[]> SHORT_SEQUENCE = new ValueType<>(short[].class, "SHORT_SEQUENCE",
+ new short[0]);
/**
- * A {@link Value} with this type contains a {@link Integer} value and
- * replaces {@code null} with a {@code Integer} containing zero.
+ * A {@link Value} with this type contains a {@link Integer} value and replaces
+ * {@code null} with a {@code Integer} containing zero.
*/
public static final ValueType<Integer> INTEGER = new ValueType<>(Integer.class, "INTEGER", Integer.valueOf(0));
/**
- * A {@link Value} with this type contains a {@code int[]} value and
- * replaces {@code null} with an empty {@code int} array.
+ * A {@link Value} with this type contains a {@code int[]} value and replaces
+ * {@code null} with an empty {@code int} array.
*/
- public static final ValueType<int[]> INTEGER_SEQUENCE = new ValueType<>(int[].class, "INTEGER_SEQUENCE", new int[0]);
+ public static final ValueType<int[]> INTEGER_SEQUENCE = new ValueType<>(int[].class, "INTEGER_SEQUENCE",
+ new int[0]);
/**
* A {@link Value} with this type contains a {@link Long} value and replaces
@@ -107,113 +111,121 @@
public static final ValueType<Long> LONG = new ValueType<>(Long.class, "LONG", Long.valueOf(0));
/**
- * A {@link Value} with this type contains a {@code long[]} value and
- * replaces {@code null} with an empty {@code long} array.
+ * A {@link Value} with this type contains a {@code long[]} value and replaces
+ * {@code null} with an empty {@code long} array.
*/
public static final ValueType<long[]> LONG_SEQUENCE = new ValueType<>(long[].class, "LONG_SEQUENCE", new long[0]);
/**
- * A {@link Value} with this type contains a {@link Float} value and
- * replaces {@code null} with a {@code Float} containing zero.
+ * A {@link Value} with this type contains a {@link Float} value and replaces
+ * {@code null} with a {@code Float} containing zero.
*/
public static final ValueType<Float> FLOAT = new ValueType<>(Float.class, "FLOAT", Float.valueOf(0));
/**
- * A {@link Value} with this type contains a {@code float[]} value and
- * replaces {@code null} with an empty {@code float} array.
+ * A {@link Value} with this type contains a {@code float[]} value and replaces
+ * {@code null} with an empty {@code float} array.
*/
- public static final ValueType<float[]> FLOAT_SEQUENCE = new ValueType<>(float[].class, "FLOAT_SEQUENCE", new float[0]);
+ public static final ValueType<float[]> FLOAT_SEQUENCE = new ValueType<>(float[].class, "FLOAT_SEQUENCE",
+ new float[0]);
/**
- * A {@link Value} with this type contains a {@link Double} value and
- * replaces {@code null} with a {@code Double} containing zero.
+ * A {@link Value} with this type contains a {@link Double} value and replaces
+ * {@code null} with a {@code Double} containing zero.
*/
public static final ValueType<Double> DOUBLE = new ValueType<>(Double.class, "DOUBLE", Double.valueOf(0));
/**
- * A {@link Value} with this type contains a {@code double[]} value and
- * replaces {@code null} with an empty {@code double} array.
+ * A {@link Value} with this type contains a {@code double[]} value and replaces
+ * {@code null} with an empty {@code double} array.
*/
- public static final ValueType<double[]> DOUBLE_SEQUENCE = new ValueType<>(double[].class, "DOUBLE_SEQUENCE", new double[0]);
+ public static final ValueType<double[]> DOUBLE_SEQUENCE = new ValueType<>(double[].class, "DOUBLE_SEQUENCE",
+ new double[0]);
/**
- * A {@link Value} with this type contains a {@code byte[]} value and
- * replaces {@code null} with an empty {@code byte} array.
+ * A {@link Value} with this type contains a {@code byte[]} value and replaces
+ * {@code null} with an empty {@code byte} array.
*/
public static final ValueType<byte[]> BYTE_STREAM = new ValueType<>(byte[].class, "BYTE_STREAM", new byte[0]);
/**
- * A {@link Value} with this type contains a {@code byte[][]} value and
- * replaces {@code null} with an empty {@code byte[][]} array.
+ * A {@link Value} with this type contains a {@code byte[][]} value and replaces
+ * {@code null} with an empty {@code byte[][]} array.
*/
- public static final ValueType<byte[][]> BYTE_STREAM_SEQUENCE = new ValueType<>(byte[][].class, "BYTE_STREAM_SEQUENCE", new byte[0][]);
+ public static final ValueType<byte[][]> BYTE_STREAM_SEQUENCE = new ValueType<>(byte[][].class,
+ "BYTE_STREAM_SEQUENCE", new byte[0][]);
/**
- * A {@link Value} with this type contains a {@link FloatComplex} value and
- * does not replaces {@code null}.
+ * A {@link Value} with this type contains a {@link FloatComplex} value and does
+ * not replaces {@code null}.
*/
- public static final ValueType<FloatComplex> FLOAT_COMPLEX = new ValueType<>(FloatComplex.class, "FLOAT_COMPLEX", null);
+ public static final ValueType<FloatComplex> FLOAT_COMPLEX = new ValueType<>(FloatComplex.class, "FLOAT_COMPLEX",
+ null);
/**
- * A {@link Value} with this type contains a {@code FloatComplex[]} value
- * and replaces {@code null} with an empty {@code FloatComplex[]} array.
+ * A {@link Value} with this type contains a {@code FloatComplex[]} value and
+ * replaces {@code null} with an empty {@code FloatComplex[]} array.
*/
- public static final ValueType<FloatComplex[]> FLOAT_COMPLEX_SEQUENCE = new ValueType<>(FloatComplex[].class, "FLOAT_COMPLEX_SEQUENCE", new FloatComplex[0]);
+ public static final ValueType<FloatComplex[]> FLOAT_COMPLEX_SEQUENCE = new ValueType<>(FloatComplex[].class,
+ "FLOAT_COMPLEX_SEQUENCE", new FloatComplex[0]);
/**
* A {@link Value} with this type contains a {@link DoubleComplex} value and
* does not replaces {@code null}.
*/
- public static final ValueType<DoubleComplex> DOUBLE_COMPLEX = new ValueType<>(DoubleComplex.class, "DOUBLE_COMPLEX", null);
+ public static final ValueType<DoubleComplex> DOUBLE_COMPLEX = new ValueType<>(DoubleComplex.class, "DOUBLE_COMPLEX",
+ null);
/**
- * A {@link Value} with this type contains a {@code DoubleComplex[]} value
- * and replaces {@code null} with an empty {@code DoubleComplex[]} array.
+ * A {@link Value} with this type contains a {@code DoubleComplex[]} value and
+ * replaces {@code null} with an empty {@code DoubleComplex[]} array.
*/
- public static final ValueType<DoubleComplex[]> DOUBLE_COMPLEX_SEQUENCE = new ValueType<>(DoubleComplex[].class, "DOUBLE_COMPLEX_SEQUENCE" , new DoubleComplex[0]);
+ public static final ValueType<DoubleComplex[]> DOUBLE_COMPLEX_SEQUENCE = new ValueType<>(DoubleComplex[].class,
+ "DOUBLE_COMPLEX_SEQUENCE", new DoubleComplex[0]);
/**
- * A {@link Value} with this type contains a modeled enumeration constant
- * value and does not replace {@code null}.
+ * A {@link Value} with this type contains a modeled enumeration constant value
+ * and does not replace {@code null}.
*
*/
public static final ValueType<EnumerationValue> ENUMERATION = new ValueType<>("ENUMERATION");
/**
- * A {@link Value} with this type contains a modeled enumeration constant
- * array value and replaces {@code null} with an empty array with defined
- * component type.
+ * A {@link Value} with this type contains a modeled enumeration constant array
+ * value and replaces {@code null} with an empty array with defined component
+ * type.
*
*/
public static final ValueType<EnumerationValue[]> ENUMERATION_SEQUENCE = new ValueType<>("ENUMERATION_SEQUENCE");
/**
- * A {@link Value} with this type contains a {@link FileLink} value and does
- * not replace {@code null}.
+ * A {@link Value} with this type contains a {@link FileLink} value and does not
+ * replace {@code null}.
*/
- public static final ValueType<FileLink> FILE_LINK = new ValueType<>(FileLink.class, "FILE_LINK" , null);
+ public static final ValueType<FileLink> FILE_LINK = new ValueType<>(FileLink.class, "FILE_LINK", null);
/**
* A {@link Value} with this type contains a {@code FileLink[]} value and
* replaces {@code null} with an empty {@code FileLink} array.
*/
- public static final ValueType<FileLink[]> FILE_LINK_SEQUENCE = new ValueType<>(FileLink[].class, "FILE_LINK_SEQUENCE" , new FileLink[0]);
+ public static final ValueType<FileLink[]> FILE_LINK_SEQUENCE = new ValueType<>(FileLink[].class,
+ "FILE_LINK_SEQUENCE", new FileLink[0]);
/**
* TODO ...
*/
- public static final ValueType<Object> BLOB = new ValueType<>(Object.class, "", null);
+ public static final ValueType<Object> BLOB = new ValueType<>(Object.class, "", null);
/**
- * A {@link Value} with this type contains a {@link Object} value and does
- * not replace {@code null}. This value type does not have a corresponding
- * sequence type.
+ * A {@link Value} with this type contains a {@link Object} value and does not
+ * replace {@code null}. This value type does not have a corresponding sequence
+ * type.
*/
- public static final ValueType<Object> UNKNOWN = new ValueType<>(Object.class, "UNKNOWN", null);
+ public static final ValueType<Object> UNKNOWN = new ValueType<>(Object.class, "UNKNOWN", null);
/**
- * The type is used to check assignment compatibility of non {@code null}
- * values passed to {@link Value#set(Object)}.
+ * The type is used to check assignment compatibility of non {@code null} values
+ * passed to {@link Value#set(Object)}.
*/
private final Class<T> type;
@@ -235,13 +247,12 @@
/**
* Constructor.
- * @param type
- * The type of value a {@link Value} with this value type will
- * accept.
+ *
+ * @param type The type of value a {@link Value} with this value type
+ * will accept.
* @param name
- * @param defaultValue
- * Will be used as {@code null} replacement in
- * {@link Value#set(Object)}.
+ * @param defaultValue Will be used as {@code null} replacement in
+ * {@link Value#set(Object)}.
*/
private ValueType(Class<T> type, String name, T defaultValue) {
super(name);
@@ -258,13 +269,11 @@
* <b>Note:</b> This method is only allowed to be called where
* {@link #isEnumerationType()} returns {@code false}.
*
- * @param name
- * The name of the attribute.
- * @param input
- * The initial value.
+ * @param name The name of the attribute.
+ * @param input The initial value.
* @return The created {@code Value} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code true}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code true}.
*/
public Value create(String name, Object input) {
return create(name, "", true, input);
@@ -272,19 +281,18 @@
/**
* Creates a new {@link Value} initialized with given name. The {@code
- * Value}'s initial validity flag will be set to {@code false}, the unit
- * name will be omitted. The initial value will be the one defined in
+ * Value}'s initial validity flag will be set to {@code false}, the unit name
+ * will be omitted. The initial value will be the one defined in
* {@link #defaultValue}.
*
* <p>
* <b>Note:</b> This method is only allowed to be called where
* {@link #isEnumerationType()} returns {@code false}.
*
- * @param name
- * The name of the attribute.
+ * @param name The name of the attribute.
* @return The created {@code Value} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code true}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code true}.
*/
public Value create(String name) {
return create(name, "", false, defaultValue);
@@ -297,17 +305,13 @@
* <b>Note:</b> This method is only allowed to be called where
* {@link #isEnumerationType()} returns {@code false}.
*
- * @param name
- * The name of the attribute.
- * @param unit
- * The unit name of the attribute.
- * @param valid
- * The initial validity flag.
- * @param input
- * The initial value.
+ * @param name The name of the attribute.
+ * @param unit The unit name of the attribute.
+ * @param valid The initial validity flag.
+ * @param input The initial value.
* @return The created {@code Value} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code true}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code true}.
*/
public Value create(String name, String unit, boolean valid, Object input) {
if (isEnumerationType()) {
@@ -319,8 +323,8 @@
/**
* Creates a new {@link Value} initialized with given name. The {@code
- * Value}'s initial validity flag will be set to {@code false}, the unit
- * name will be omitted. The initial value will be {@code null} if
+ * Value}'s initial validity flag will be set to {@code false}, the unit name
+ * will be omitted. The initial value will be {@code null} if
* {@link #isSequence()} returns {@code false} otherwise an empty array with
* given component type in enumClass is used.
*
@@ -328,13 +332,11 @@
* <b>Note:</b> This method is only allowed to be called where
* {@link #isEnumerationType()} returns {@code true}.
*
- * @param <E>
- * Modeled enumeration type.
- * @param name
- * The name of the attribute.
+ * @param <E> Modeled enumeration type.
+ * @param name The name of the attribute.
* @return The created {@code Value} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code false}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code false}.
*/
public <E extends EnumerationValue> Value create(Enumeration<E> enumObj, String name) {
return create(name, "", false, null, enumObj.getName());
@@ -347,21 +349,17 @@
* <b>Note:</b> This method is only allowed to be called where
* {@link #isEnumerationType()} returns {@code true}.
*
- * @param <E>
- * Modeled enumeration type.
- * @param name
- * The name of the attribute.
- * @param unit
- * The unit name of the attribute.
- * @param valid
- * The initial validity flag.
- * @param input
- * The initial value.
+ * @param <E> Modeled enumeration type.
+ * @param name The name of the attribute.
+ * @param unit The unit name of the attribute.
+ * @param valid The initial validity flag.
+ * @param input The initial value.
* @return The created {@code Value} is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code false}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code false}.
*/
- public <E extends EnumerationValue> Value create(String name, String unit, boolean valid, Object input, String valueTypeDescr) {
+ public <E extends EnumerationValue> Value create(String name, String unit, boolean valid, Object input,
+ String valueTypeDescr) {
if (isEnumerationType()) {
Object nullReplacement = null;
Class<?> valueClass = EnumerationValue.class;
@@ -975,12 +973,11 @@
}
/**
- * Returns the sequence version of this value type. This method returns
- * itself, if this value type is a sequence type.
+ * Returns the sequence version of this value type. This method returns itself,
+ * if this value type is a sequence type.
*
- * If you extend the class ValueType, you have to ensure that T contains a field
- * of the correct name and type,
- * otherwise a runtime error will occur.
+ * If you extend the class ValueType, you have to ensure that T contains a field
+ * of the correct name and type, otherwise a runtime error will occur.
*
* @return The sequence version of this value type is returned.
*/
@@ -994,19 +991,18 @@
}
/**
- * Returns the scalar version of this value type. This method returns
- * itself, if this value type is a scalar type.
+ * Returns the scalar version of this value type. This method returns itself, if
+ * this value type is a scalar type.
*
- * If you extend the class ValueType, you have to ensure that T
- * contains a field of the correct name and type,
- * otherwise a runtime error will occur.
+ * If you extend the class ValueType, you have to ensure that T contains a field
+ * of the correct name and type, otherwise a runtime error will occur.
*
* @return The sequence version of this value type is returned.
*/
@SuppressWarnings("unchecked")
public <S extends ValueType<?>> S toSingleType() {
- if(isEnumerationType()) {
+ if (isEnumerationType()) {
if (isSequence()) {
return (S) valueOf(name().replace("_SEQUENCE", ""));
}
@@ -1014,7 +1010,7 @@
return (S) this;
} else {
try {
- if(isSequence()) {
+ if (isSequence()) {
Field field = getClass().getField(name().replace("_SEQUENCE", ""));
return (S) field.get(this);
}
@@ -1029,8 +1025,8 @@
* Returns the value class for this value type.
*
* @return The value class is returned.
- * @throws IllegalStateException
- * Thrown if {@link #isEnumerationType()} returns {@code true}.
+ * @throws IllegalStateException Thrown if {@link #isEnumerationType()} returns
+ * {@code true}.
*/
public Class<?> getValueClass() {
if (isEnumerationType()) {
@@ -1039,5 +1035,4 @@
return type;
}
-
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/model/VersionState.java b/src/main/java/org/eclipse/mdm/api/base/model/VersionState.java
index c282768..b2b6acb 100644
--- a/src/main/java/org/eclipse/mdm/api/base/model/VersionState.java
+++ b/src/main/java/org/eclipse/mdm/api/base/model/VersionState.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -30,14 +29,14 @@
// ======================================================================
/**
- * An entity with this version state is still editable and hence not allowed
- * be used when creating new entities.
+ * An entity with this version state is still editable and hence not allowed be
+ * used when creating new entities.
*/
public static final VersionState EDITABLE = new VersionState("EDITABLE", 0);
/**
- * An entity with this version state is no longer editable and is allowed to
- * be used when creating new entities.
+ * An entity with this version state is no longer editable and is allowed to be
+ * used when creating new entities.
*
* <p>
* <b>Note:</b> If an entity's version state is this state, then its version
@@ -46,8 +45,8 @@
public static final VersionState VALID = new VersionState("VALID", 1);
/**
- * An entity with this version state is neither editable nor is it allowed
- * to use it when creating new entities
+ * An entity with this version state is neither editable nor is it allowed to
+ * use it when creating new entities
*
* <p>
* <b>Note:</b> If an entity's version state is this state, then its version
@@ -88,5 +87,5 @@
public boolean isArchived() {
return ARCHIVED == this;
}
-
+
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationException.java b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationException.java
index dcb3771..20744f5 100644
--- a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationException.java
+++ b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationException.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.notification;
@@ -28,8 +27,7 @@
/**
* Constructor.
*
- * @param message
- * The error message.
+ * @param message The error message.
*/
public NotificationException(String message) {
super(message);
@@ -38,10 +36,8 @@
/**
* Constructor.
*
- * @param message
- * The error message.
- * @param throwable
- * The origin cause.
+ * @param message The error message.
+ * @param throwable The origin cause.
*/
public NotificationException(String message, Throwable cause) {
super(message, cause);
diff --git a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationFilter.java b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationFilter.java
index 2c94f79..f28eea2 100644
--- a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationFilter.java
+++ b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationFilter.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.notification;
@@ -56,8 +55,7 @@
/**
* Sets the {@link ModificationType}s used to filter the notifications.
*
- * @param types
- * Set with {@link ModificationType}
+ * @param types Set with {@link ModificationType}
*/
public void setTypes(Set<ModificationType> types) {
this.types = EnumSet.copyOf(types);
@@ -75,8 +73,7 @@
/**
* Sets the {@link EntityType}s used to filter the notifications.
*
- * @param entityTypes
- * Set with {@link EntityType}.
+ * @param entityTypes Set with {@link EntityType}.
*/
public void setEntityTypes(Set<EntityType> entityTypes) {
this.entityTypes = new HashSet<>(entityTypes);
diff --git a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationListener.java b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationListener.java
index 5cc530f..2c86cd0 100644
--- a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationListener.java
+++ b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationListener.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.notification;
@@ -31,55 +30,43 @@
/**
* Called when a new instance element was created by the server.
*
- * @param entities
- * A list of newly created entities.
- * @param user
- * The user who created the entities.
+ * @param entities A list of newly created entities.
+ * @param user The user who created the entities.
*/
void instanceCreated(List<? extends Entity> entities, User user);
/**
* Called when a existing instance element was modified by the server.
*
- * @param entities
- * A list of modified entities.
- * @param user
- * The user who modified the entities.
+ * @param entities A list of modified entities.
+ * @param user The user who modified the entities.
*/
void instanceModified(List<? extends Entity> entities, User user);
/**
* Called when a existing instance element was deleted by the server.
*
- * @param entityType
- * EntityType of the deleted entities.
- * @param entities
- * A list with the IDs of deleted entities.
- * @param user
- * The user who deleted the entities.
+ * @param entityType EntityType of the deleted entities.
+ * @param entities A list with the IDs of deleted entities.
+ * @param user The user who deleted the entities.
*/
void instanceDeleted(EntityType entityType, List<String> ids, User user);
/**
* Called when the application model is changed by the server
*
- * @param entityType
- * Modified entityType.
- * @param user
- * The user who modified the application model.
+ * @param entityType Modified entityType.
+ * @param user The user who modified the application model.
*/
void modelModified(EntityType entityType, User user);
/**
* Called when security related information is changed by the server
*
- * @param entityType
- * EntityType with changed security
- * @param entities
- * A list with the IDs of entities related to the change. Empty
- * if change was only relevant for entityType.
- * @param user
- * The user who modified security information.
+ * @param entityType EntityType with changed security
+ * @param entities A list with the IDs of entities related to the change.
+ * Empty if change was only relevant for entityType.
+ * @param user The user who modified security information.
*/
void securityModified(EntityType entityType, List<String> ids, User user);
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationService.java b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationService.java
index 7da6872..1cacc27 100644
--- a/src/main/java/org/eclipse/mdm/api/base/notification/NotificationService.java
+++ b/src/main/java/org/eclipse/mdm/api/base/notification/NotificationService.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.notification;
@@ -26,41 +25,32 @@
/**
* Registers a NotificationListener at the underlying notification service.
*
- * @param registrationName
- * An unique name used for the registration.
- * @param filter
- * A notification filter, specifying which events should be
- * received by the listener.
- * @param listener
- * A notification listener which is informed if new events are
- * received.
- * @throws NotificationException
- * In case the listener cannot be registered at the notification
- * service.
+ * @param registrationName An unique name used for the registration.
+ * @param filter A notification filter, specifying which events should
+ * be received by the listener.
+ * @param listener A notification listener which is informed if new
+ * events are received.
+ * @throws NotificationException In case the listener cannot be registered at
+ * the notification service.
*/
void register(String registrationName, NotificationFilter filter, NotificationListener listener)
throws NotificationException;
/**
- * Unregisters a NotificationListener from the underlying notification
- * service.
+ * Unregisters a NotificationListener from the underlying notification service.
*
- * @param registrationName
- * The unique name previously used for the registration.
- * @throws NotificationException
- * In case the listener cannot be deregistered.
+ * @param registrationName The unique name previously used for the registration.
+ * @throws NotificationException In case the listener cannot be deregistered.
*/
void deregister(String registrationName) throws NotificationException;
/**
* Closes the NotificationManager and all registered NotificationListeners
*
- * @param deregisterAll
- * if true, all NotificationListeners are also deregistered
- * before closing.
- * @throws NotificationException
- * In case the listeners cannot be deregistered or the manager
- * cannot be closed.
+ * @param deregisterAll if true, all NotificationListeners are also deregistered
+ * before closing.
+ * @throws NotificationException In case the listeners cannot be deregistered or
+ * the manager cannot be closed.
*/
void close(boolean deregisterAll) throws NotificationException;
}
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Aggregation.java b/src/main/java/org/eclipse/mdm/api/base/query/Aggregation.java
index fa4356e..7f6fb2d 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Aggregation.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Aggregation.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -64,8 +63,8 @@
AVERAGE,
/**
- * Over all result rows for the selected attribute the standard deviation
- * value is calculated. Only for numerical values.
+ * Over all result rows for the selected attribute the standard deviation value
+ * is calculated. Only for numerical values.
*/
DEVIATION,
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/BooleanOperator.java b/src/main/java/org/eclipse/mdm/api/base/query/BooleanOperator.java
index 9b87d41..c3d144a 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/BooleanOperator.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/BooleanOperator.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -30,7 +29,6 @@
// Enumerations
// ======================================================================
-
/**
* Logical conjunction.
*/
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/BracketOperator.java b/src/main/java/org/eclipse/mdm/api/base/query/BracketOperator.java
index 9bdc974..dd8a90f 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/BracketOperator.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/BracketOperator.java
@@ -1,52 +1,52 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.query;
-
-/**
-* The bracket operator enumeration.
-*
-* @since 1.0.0
-* @see Condition
-* @see Filter
-*/
-
-public enum BracketOperator {
- /**
- * Left parenthesis.
- */
- OPEN,
-
- /**
- * Right parenthesis.
- */
- CLOSE;
-
- /*
- * (non-Javadoc)
- * @see java.lang.Enum#toString()
- */
- @Override
- public String toString() {
- switch (this) {
- case OPEN:
- return "(";
- case CLOSE:
- return ")";
- default:
- return this.toString();
- }
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.query;
+
+/**
+ * The bracket operator enumeration.
+ *
+ * @since 1.0.0
+ * @see Condition
+ * @see Filter
+ */
+
+public enum BracketOperator {
+ /**
+ * Left parenthesis.
+ */
+ OPEN,
+
+ /**
+ * Right parenthesis.
+ */
+ CLOSE;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Enum#toString()
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case OPEN:
+ return "(";
+ case CLOSE:
+ return ")";
+ default:
+ return this.toString();
+ }
+ }
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/ComparisonOperator.java b/src/main/java/org/eclipse/mdm/api/base/query/ComparisonOperator.java
index 04399f6..46f3cd4 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/ComparisonOperator.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/ComparisonOperator.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -130,8 +129,8 @@
CASE_INSENSITIVE_NOT_IN_SET,
/**
- * like, use pattern matching, see Pattern for the wildcard definitions.
- * case insensitive for DT_STRING.
+ * like, use pattern matching, see Pattern for the wildcard definitions. case
+ * insensitive for DT_STRING.
*/
CASE_INSENSITIVE_LIKE,
@@ -152,8 +151,8 @@
/**
* Between; selects all instances where the value of 'attr' lies between the
- * first two values given in 'value' (with 'attr', 'value' being elements of
- * the SelValue structure; 'value' must be of data type S_*).
+ * first two values given in 'value' (with 'attr', 'value' being elements of the
+ * SelValue structure; 'value' must be of data type S_*).
*/
BETWEEN;
@@ -164,10 +163,8 @@
/**
* Creates a new {@link Condition} for given {@link Attribute} and value.
*
- * @param attribute
- * The {@code Attribute} the condition will be applied to.
- * @param value
- * The value.
+ * @param attribute The {@code Attribute} the condition will be applied to.
+ * @param value The value.
* @return The created {@code Condition} is returned.
*/
public Condition create(Attribute attribute, Object value) {
@@ -179,8 +176,8 @@
// ======================================================================
/**
- * Checks whether this operation requires a sequence value container. This
- * is the case for the following types:
+ * Checks whether this operation requires a sequence value container. This is
+ * the case for the following types:
*
* <ul>
* <li>{@link ComparisonOperator#IN_SET}</li>
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Condition.java b/src/main/java/org/eclipse/mdm/api/base/query/Condition.java
index 0b50469..bc59e40 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Condition.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Condition.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -46,14 +45,11 @@
/**
* Constructor.
*
- * @param attribute
- * The {@link Attribute} this condition will be applied to.
- * @param comparisonOperator
- * The condition {@link ComparisonOperator}.
- * @param unit
- * The unit of the created value.
- * @param input
- * The condition value.
+ * @param attribute The {@link Attribute} this condition will be
+ * applied to.
+ * @param comparisonOperator The condition {@link ComparisonOperator}.
+ * @param unit The unit of the created value.
+ * @param input The condition value.
*/
Condition(Attribute attribute, ComparisonOperator comparisonOperator, String unit, Object input) {
this.attribute = attribute;
@@ -92,9 +88,10 @@
public ComparisonOperator getComparisonOperator() {
return comparisonOperator;
}
-
+
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
@@ -108,22 +105,23 @@
Condition condition = (Condition) other;
- return Objects.equals(this.attribute, condition.attribute)
- && Objects.equals(this.value, condition.value)
+ return Objects.equals(this.attribute, condition.attribute) && Objects.equals(this.value, condition.value)
&& Objects.equals(this.comparisonOperator, condition.comparisonOperator);
}
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return Objects.hash(attribute, value, comparisonOperator);
}
-
+
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/DataAccessException.java b/src/main/java/org/eclipse/mdm/api/base/query/DataAccessException.java
index 0c6dda6..cd477f4 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/DataAccessException.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/DataAccessException.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -36,8 +35,7 @@
/**
* Constructor.
*
- * @param message
- * The error message.
+ * @param message The error message.
*/
public DataAccessException(String message) {
super(message);
@@ -46,10 +44,8 @@
/**
* Constructor.
*
- * @param message
- * The error message.
- * @param throwable
- * The origin cause.
+ * @param message The error message.
+ * @param throwable The origin cause.
*/
public DataAccessException(String message, Throwable throwable) {
super(message, throwable);
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Filter.java b/src/main/java/org/eclipse/mdm/api/base/query/Filter.java
index bed881d..ae29ac5 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Filter.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Filter.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -31,8 +30,8 @@
import org.eclipse.mdm.api.base.search.SearchService;
/**
- * A filter is a sequence of {@link FilterItem}s containing {@link BooleanOperator}s or
- * {@link Condition}s.
+ * A filter is a sequence of {@link FilterItem}s containing
+ * {@link BooleanOperator}s or {@link Condition}s.
*
* @since 1.0.0
* @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
@@ -57,8 +56,8 @@
/**
* Constructor.
*
- * @param operatorItem
- * Will be added between {@link Condition}s or merged filters.
+ * @param operatorItem Will be added between {@link Condition}s or merged
+ * filters.
*/
private Filter(FilterItem operatorItem) {
this.operatorItem = operatorItem;
@@ -72,10 +71,8 @@
* Creates a new filter with an instance ID condition for given
* {@link EntityType} and instance ID.
*
- * @param entityType
- * The {@code EntityType}.
- * @param id
- * The instance ID.
+ * @param entityType The {@code EntityType}.
+ * @param id The instance ID.
* @return The created filter is returned.
* @see #id(EntityType, String)
*/
@@ -84,13 +81,11 @@
}
/**
- * Creates a new filter with an foreign ID condition for given
- * {@link Relation} and instance ID.
+ * Creates a new filter with an foreign ID condition for given {@link Relation}
+ * and instance ID.
*
- * @param relation
- * The {@code Relation}.
- * @param id
- * The instance ID.
+ * @param relation The {@code Relation}.
+ * @param id The instance ID.
* @return The created filter is returned.
* @see #id(Relation, String)
*/
@@ -102,10 +97,8 @@
* Creates a new filter with an instance IDs condition for given
* {@link EntityType} and instance IDs.
*
- * @param entityType
- * The {@code EntityType}.
- * @param ids
- * The instance IDs.
+ * @param entityType The {@code EntityType}.
+ * @param ids The instance IDs.
* @return The created filter is returned.
* @see #ids(EntityType, Collection)
*/
@@ -114,13 +107,11 @@
}
/**
- * Creates a new filter with an foreign IDs condition for given
- * {@link Relation} and instance IDs.
+ * Creates a new filter with an foreign IDs condition for given {@link Relation}
+ * and instance IDs.
*
- * @param relation
- * The {@code Relation}.
- * @param ids
- * The instance IDs.
+ * @param relation The {@code Relation}.
+ * @param ids The instance IDs.
* @return The created filter is returned.
* @see #ids(Relation, Collection)
*/
@@ -132,12 +123,10 @@
* Creates a new filter with an instance name condition for given
* {@link EntityType} and instance name pattern.
*
- * @param entityType
- * The {@code EntityType}.
- * @param pattern
- * Is always case sensitive and may contain wildcard characters
- * as follows: "?" for one matching character and "*" for a
- * sequence of matching characters.
+ * @param entityType The {@code EntityType}.
+ * @param pattern Is always case sensitive and may contain wildcard
+ * characters as follows: "?" for one matching character and
+ * "*" for a sequence of matching characters.
* @return The created filter is returned.
* @see #name(EntityType, String)
*/
@@ -187,8 +176,7 @@
/**
* Adds all {@link Condition}s to this filter.
*
- * @param conditions
- * The {@link Condition}s that will be added.
+ * @param conditions The {@link Condition}s that will be added.
* @return Returns this filter.
* @see Filter#add(Condition)
*/
@@ -200,8 +188,7 @@
/**
* Adds all {@link Condition}s to this filter.
*
- * @param conditions
- * The {@link Condition}s that will be added.
+ * @param conditions The {@link Condition}s that will be added.
* @return Returns this filter.
* @see Filter#add(Condition)
*/
@@ -214,10 +201,8 @@
* Adds a new instance ID condition ({@link ComparisonOperator#EQUAL}) for given
* {@link EntityType} and instance ID to this filter.
*
- * @param entityType
- * The {@code EntityType}.
- * @param id
- * The instance ID.
+ * @param entityType The {@code EntityType}.
+ * @param id The instance ID.
* @return Returns this filter.
* @see #add(Condition)
*/
@@ -230,10 +215,8 @@
* Adds a new foreign ID condition ({@link ComparisonOperator#EQUAL}) for given
* {@link Relation} and instance ID to this filter.
*
- * @param relation
- * The {@code Relation}.
- * @param id
- * The instance ID.
+ * @param relation The {@code Relation}.
+ * @param id The instance ID.
* @return Returns this filter.
* @see #add(Condition)
*/
@@ -243,13 +226,11 @@
}
/**
- * Adds a new instance IDs condition ({@link ComparisonOperator#IN_SET}) for given
- * {@link EntityType} and instance IDs to this filter.
+ * Adds a new instance IDs condition ({@link ComparisonOperator#IN_SET}) for
+ * given {@link EntityType} and instance IDs to this filter.
*
- * @param entityType
- * The {@code EntityType}.
- * @param ids
- * The instance IDs.
+ * @param entityType The {@code EntityType}.
+ * @param ids The instance IDs.
* @return Returns this filter
* @see #add(Condition)
*/
@@ -260,19 +241,16 @@
}
/**
- * Adds a new foreign IDs condition ({@link ComparisonOperator#IN_SET}) for given
- * {@link Relation} and instance IDs to this filter.
+ * Adds a new foreign IDs condition ({@link ComparisonOperator#IN_SET}) for
+ * given {@link Relation} and instance IDs to this filter.
*
- * @param relation
- * The {@code Relation}.
- * @param ids
- * The instance IDs.
+ * @param relation The {@code Relation}.
+ * @param ids The instance IDs.
* @return Returns this filter.
* @see #add(Condition)
*/
public Filter ids(Relation relation, Collection<String> ids) {
- add(ComparisonOperator.IN_SET.create(relation.getAttribute(),
- ids.stream().distinct().toArray(String[]::new)));
+ add(ComparisonOperator.IN_SET.create(relation.getAttribute(), ids.stream().distinct().toArray(String[]::new)));
return this;
}
@@ -281,15 +259,13 @@
* {@link EntityType} and instance name pattern.
*
* <p>
- * <b>NOTE:</b> If the given pattern equals "*", then no {@link Condition}
- * will be added since "*" means take all.
+ * <b>NOTE:</b> If the given pattern equals "*", then no {@link Condition} will
+ * be added since "*" means take all.
*
- * @param entityType
- * The {@code EntityType}.
- * @param pattern
- * Is always case sensitive and may contain wildcard characters
- * as follows: "?" for one matching character and "*" for a
- * sequence of matching characters.
+ * @param entityType The {@code EntityType}.
+ * @param pattern Is always case sensitive and may contain wildcard
+ * characters as follows: "?" for one matching character and
+ * "*" for a sequence of matching characters.
* @return Returns this filter.
* @see #add(Condition)
*/
@@ -301,11 +277,9 @@
}
/**
- * Adds given {@link Condition} to this filter's {@link FilterItem}
- * sequence.
+ * Adds given {@link Condition} to this filter's {@link FilterItem} sequence.
*
- * @param condition
- * {@code Condition} that will be added.
+ * @param condition {@code Condition} that will be added.
* @return Returns this filter.
*/
public Filter add(Condition condition) {
@@ -317,8 +291,7 @@
/**
* Merges all given filters with this filter.
*
- * @param filters
- * Filters that will be merged.
+ * @param filters Filters that will be merged.
* @return Returns this filter.
* @see #merge(Filter)
*/
@@ -330,8 +303,7 @@
/**
* Merges all given filters with this filter.
*
- * @param filters
- * Filters that will be merged.
+ * @param filters Filters that will be merged.
* @return Returns this filter.
* @see #merge(Filter)
*/
@@ -361,8 +333,7 @@
* filter.merge(filter1, filter2); // (filter1) OR filter2
* </pre>
*
- * @param filter
- * Filter that will be merged.
+ * @param filter Filter that will be merged.
* @return Returns this filter.
*/
public Filter merge(Filter filter) {
@@ -404,9 +375,8 @@
* </pre>
*
* @return Returns this filter.
- * @throws IllegalStateException
- * Thrown either if the current set of conditions is empty or
- * this filter is already inverted.
+ * @throws IllegalStateException Thrown either if the current set of conditions
+ * is empty or this filter is already inverted.
*/
public Filter invert() {
if (filterItems.isEmpty()) {
@@ -427,16 +397,15 @@
/**
* Checks whether this filter has no conditions at all.
*
- * @return Returns {@code false} if at least one {@link Condition} is
- * contained.
+ * @return Returns {@code false} if at least one {@link Condition} is contained.
*/
public boolean isEmtpty() {
return filterItems.isEmpty();
}
/**
- * Returns a sequential stream with the internally stored
- * {@link FilterItem}s as its source.
+ * Returns a sequential stream with the internally stored {@link FilterItem}s as
+ * its source.
*
* @return A stream over the contained {@code FilterItem}s is returned.
*/
@@ -445,11 +414,11 @@
}
/**
- * Returns an iterator over the {@link FilterItem}s contained in this filter
- * in proper sequence.
+ * Returns an iterator over the {@link FilterItem}s contained in this filter in
+ * proper sequence.
*
- * @return The returned iterator does not support the
- * {@link Iterator#remove()} operation.
+ * @return The returned iterator does not support the {@link Iterator#remove()}
+ * operation.
*/
@Override
public Iterator<FilterItem> iterator() {
@@ -534,6 +503,7 @@
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/FilterItem.java b/src/main/java/org/eclipse/mdm/api/base/query/FilterItem.java
index 919def9..602897a 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/FilterItem.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/FilterItem.java
@@ -1,24 +1,24 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
import java.util.Objects;
/**
- * Filter item contains either a {@link Condition} or an {@link BooleanOperator}.
+ * Filter item contains either a {@link Condition} or an
+ * {@link BooleanOperator}.
*
* @since 1.0.0
* @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
@@ -70,8 +70,7 @@
/**
* Constructor.
*
- * @param condition
- * The {@link Condition}.
+ * @param condition The {@link Condition}.
*/
FilterItem(Condition condition) {
this.condition = condition;
@@ -82,20 +81,18 @@
/**
* Constructor.
*
- * @param booleanOperator
- * The {@link BooleanOperator}.
+ * @param booleanOperator The {@link BooleanOperator}.
*/
private FilterItem(BooleanOperator booleanOperator) {
this.condition = null;
this.bracketOperator = null;
this.booleanOperator = booleanOperator;
}
-
+
/**
* Constructor.
*
- * @param bracketoperator
- * The {@link BracketOperator}.
+ * @param bracketoperator The {@link BracketOperator}.
*/
private FilterItem(BracketOperator bracketoperator) {
this.condition = null;
@@ -115,14 +112,13 @@
public boolean isBooleanOperator() {
return booleanOperator != null;
}
-
/**
* Returns the contained {@link BooleanOperator}.
*
* @return The {@code BooleanOperator} is returned.
- * @throws IllegalStateException
- * Thrown if {@code BooleanOperator} is not contained.
+ * @throws IllegalStateException Thrown if {@code BooleanOperator} is not
+ * contained.
*/
public BooleanOperator getBooleanOperator() {
if (isBooleanOperator()) {
@@ -145,8 +141,7 @@
* Returns the contained {@link Condition}.
*
* @return The {@code Condition} is returned.
- * @throws IllegalStateException
- * Thrown if {@code Condition} is not contained.
+ * @throws IllegalStateException Thrown if {@code Condition} is not contained.
*/
public Condition getCondition() {
if (isCondition()) {
@@ -155,7 +150,7 @@
throw new IllegalStateException("Item does not contain a condition.");
}
-
+
/**
* Checks whether an {@link BrackerOperator} is contained.
*
@@ -164,13 +159,12 @@
public boolean isBracketOperator() {
return bracketOperator != null;
}
-
+
/**
* Returns the contained {@link Condition}.
*
* @return The {@code Condition} is returned.
- * @throws IllegalStateException
- * Thrown if {@code Condition} is not contained.
+ * @throws IllegalStateException Thrown if {@code Condition} is not contained.
*/
public BracketOperator getBracketOperator() {
if (isBracketOperator()) {
@@ -179,9 +173,10 @@
throw new IllegalStateException("Item does not contain a condition.");
}
-
+
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
@@ -202,6 +197,7 @@
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
@Override
@@ -211,6 +207,7 @@
/*
* (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/JoinType.java b/src/main/java/org/eclipse/mdm/api/base/query/JoinType.java
index 5480dad..dae5ce4 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/JoinType.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/JoinType.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Query.java b/src/main/java/org/eclipse/mdm/api/base/query/Query.java
index 512974a..41e21af 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Query.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Query.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -45,11 +44,10 @@
// ======================================================================
/**
- * Checks whether given {@link EntityType} will be queried in any way
- * (select or join).
+ * Checks whether given {@link EntityType} will be queried in any way (select or
+ * join).
*
- * @param entityType
- * The checked {@code EntityType}.
+ * @param entityType The checked {@code EntityType}.
* @return True if given {@code EntityType} will be queried.
*/
boolean isQueried(EntityType entityType);
@@ -58,9 +56,8 @@
* Adds select statements for all {@link Attribute}s of each given
* {@link EntityType}.
*
- * @param entityTypes
- * The {@code Attribute}s of each {@code EntityType} will be
- * passed to {@link #select(List)}.
+ * @param entityTypes The {@code Attribute}s of each {@code EntityType} will be
+ * passed to {@link #select(List)}.
* @return This query is returned.
*/
default Query selectAll(List<EntityType> entityTypes) {
@@ -72,9 +69,8 @@
* Adds select statements for all {@link Attribute}s of each given
* {@link EntityType}.
*
- * @param entityTypes
- * The {@code Attribute}s of each {@code EntityType} will be
- * passed to {@link #select(List)}.
+ * @param entityTypes The {@code Attribute}s of each {@code EntityType} will be
+ * passed to {@link #select(List)}.
* @return This query is returned.
*/
default Query selectAll(EntityType... entityTypes) {
@@ -83,14 +79,12 @@
}
/**
- * Adds select statements for all {@link Attribute}s identified by given
- * names at given {@link EntityType}.
+ * Adds select statements for all {@link Attribute}s identified by given names
+ * at given {@link EntityType}.
*
- * @param entityType
- * The {@code EntityType} whose {@code Attribute}s will be passed
- * to {@link #select(Attribute)}.
- * @param names
- * The names of the {@code Attribute}s that have to be added.
+ * @param entityType The {@code EntityType} whose {@code Attribute}s will be
+ * passed to {@link #select(Attribute)}.
+ * @param names The names of the {@code Attribute}s that have to be added.
* @return This query is returned.
* @see EntityType#getAttribute(String)
*/
@@ -103,9 +97,8 @@
* Adds a select statement for the ID {@link Attribute} of each given
* {@link EntityType}.
*
- * @param entityTypes
- * The {@code EntityType}s whose ID {@code Attribute}s will be
- * passed to {@link #select(Attribute)}.
+ * @param entityTypes The {@code EntityType}s whose ID {@code Attribute}s will
+ * be passed to {@link #select(Attribute)}.
* @return This query is returned.
*/
default Query selectID(EntityType... entityTypes) {
@@ -116,9 +109,8 @@
/**
* Adds a select statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #select(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #select(Attribute)}.
* @return This query is returned.
*/
default Query select(List<Attribute> attributes) {
@@ -129,9 +121,8 @@
/**
* Adds a select statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #select(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #select(Attribute)}.
* @return This query is returned.
*/
default Query select(Attribute... attributes) {
@@ -142,10 +133,9 @@
/**
* Adds a select statement for given {@link Attribute}.
*
- * @param attribute
- * {@code Attribute} will be passed to
- * {@link #select(Attribute, Aggregation)} with
- * {@link Aggregation#NONE}.
+ * @param attribute {@code Attribute} will be passed to
+ * {@link #select(Attribute, Aggregation)} with
+ * {@link Aggregation#NONE}.
* @return This query is returned.
*/
default Query select(Attribute attribute) {
@@ -156,25 +146,22 @@
* Adds a select statement for given {@link Attribute} with given
* {@link Aggregation} function.
*
- * @param attribute
- * The {@code Attribute} a select statement will be added for.
- * @param aggregation
- * The {@code Aggregation} that will be applied.
+ * @param attribute The {@code Attribute} a select statement will be added
+ * for.
+ * @param aggregation The {@code Aggregation} that will be applied.
* @return This query is returned.
*/
Query select(Attribute attribute, Aggregation aggregation);
/**
- * For all unambiguous {@link Relation}s from the source {@link EntityType}
- * to each given target {@code EntityType} a join statement will be added.
+ * For all unambiguous {@link Relation}s from the source {@link EntityType} to
+ * each given target {@code EntityType} a join statement will be added.
*
- * @param source
- * The source {@code EntityType}.
- * @param targets
- * The unambiguous {@code Relation} for each target {@code
+ * @param source The source {@code EntityType}.
+ * @param targets The unambiguous {@code Relation} for each target {@code
* EntityType} is retrieved from the source {@code EntityType} using
- * {@link EntityType#getRelation(EntityType)} and passed to
- * {@link #join(Relation)}.
+ * {@link EntityType#getRelation(EntityType)} and passed to
+ * {@link #join(Relation)}.
* @return This query is returned.
*/
default Query join(EntityType source, EntityType... targets) {
@@ -185,9 +172,8 @@
/**
* Adds a join statement for each given {@link Relation}s.
*
- * @param relations
- * Each {@code Relation} will be passed to
- * {@link #join(Relation)}.
+ * @param relations Each {@code Relation} will be passed to
+ * {@link #join(Relation)}.
* @return This query is returned.
*/
default Query join(List<Relation> relations) {
@@ -198,9 +184,8 @@
/**
* Adds a join statement for each given {@link Relation}s.
*
- * @param relations
- * Each {@code Relation} will be passed to
- * {@link #join(Relation)}.
+ * @param relations Each {@code Relation} will be passed to
+ * {@link #join(Relation)}.
* @return This query is returned.
*/
default Query join(Relation... relations) {
@@ -211,9 +196,9 @@
/**
* Adds a join statement for given {@link Relation}.
*
- * @param relation
- * {@code Relation} will be passed to
- * {@link #join(Relation, JoinType)} with {@link JoinType#INNER}.
+ * @param relation {@code Relation} will be passed to
+ * {@link #join(Relation, JoinType)} with
+ * {@link JoinType#INNER}.
* @return This query is returned.
*/
default Query join(Relation relation) {
@@ -224,10 +209,8 @@
* Adds a join statement for given {@link Relation} with given {@link JoinType}
* type.
*
- * @param relation
- * The {@code Relation} a join statement will be added for.
- * @param join
- * The {@code JoinType} type that will be applied.
+ * @param relation The {@code Relation} a join statement will be added for.
+ * @param join The {@code JoinType} type that will be applied.
* @return This query is returned.
*/
Query join(Relation relation, JoinType join);
@@ -235,9 +218,8 @@
/**
* Adds a group by statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #group(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #group(Attribute)}.
* @return This query is returned.
*/
default Query group(List<Attribute> attributes) {
@@ -248,9 +230,8 @@
/**
* Adds a group by statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #group(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #group(Attribute)}.
* @return This query is returned.
*/
default Query group(Attribute... attributes) {
@@ -261,8 +242,8 @@
/**
* Adds a group by statement for given {@link Attribute}.
*
- * @param attribute
- * The {@code Attribute} a group by statement will be added for.
+ * @param attribute The {@code Attribute} a group by statement will be added
+ * for.
* @return This query is returned.
*/
Query group(Attribute attribute);
@@ -270,9 +251,8 @@
/**
* Adds an order by statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #order(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #order(Attribute)}.
* @return This query is returned.
*/
default Query order(List<Attribute> attributes) {
@@ -283,9 +263,8 @@
/**
* Adds an order by statement for each given {@link Attribute}.
*
- * @param attributes
- * Each {@code Attribute} will be passed to
- * {@link #order(Attribute)}.
+ * @param attributes Each {@code Attribute} will be passed to
+ * {@link #order(Attribute)}.
* @return This query is returned.
*/
default Query order(Attribute... attributes) {
@@ -296,10 +275,9 @@
/**
* Adds an order by statement for given {@link Attribute}.
*
- * @param attribute
- * The {@code Attribute} is passed to
- * {@link #order(Attribute, boolean)} with
- * {@code ascending = true}.
+ * @param attribute The {@code Attribute} is passed to
+ * {@link #order(Attribute, boolean)} with
+ * {@code ascending = true}.
* @return This query is returned.
*/
default Query order(Attribute attribute) {
@@ -307,13 +285,12 @@
}
/**
- * Adds an order by statement for given {@link Attribute} with given
- * ascending flag.
+ * Adds an order by statement for given {@link Attribute} with given ascending
+ * flag.
*
- * @param attribute
- * The {@code Attribute} an order by statement will be added for.
- * @param ascending
- * The ascending flag that will be applied.
+ * @param attribute The {@code Attribute} an order by statement will be added
+ * for.
+ * @param ascending The ascending flag that will be applied.
* @return This query is returned.
*/
Query order(Attribute attribute, boolean ascending);
@@ -323,24 +300,20 @@
* {@link Result}.
*
* @return {@code Optional} is empty if {@code Result} could not be found.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}.
*/
default Optional<Result> fetchSingleton() throws DataAccessException {
return fetchSingleton(Filter.and());
}
/**
- * Executes this query with given {@link Filter} and returns the
- * {@link Result}.
+ * Executes this query with given {@link Filter} and returns the {@link Result}.
*
- * @param filter
- * The criteria sequence.
+ * @param filter The criteria sequence.
* @return {@code Optional} is empty if {@code Result} could not be found.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}.
*/
Optional<Result> fetchSingleton(Filter filter) throws DataAccessException;
@@ -349,9 +322,8 @@
* {@link Result}s.
*
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
*/
default List<Result> fetch() throws DataAccessException {
return fetch(Filter.and());
@@ -361,12 +333,10 @@
* Executes this query with given {@link Filter} and returns the
* {@link Result}s.
*
- * @param filter
- * The criteria sequence.
+ * @param filter The criteria sequence.
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
*/
List<Result> fetch(Filter filter) throws DataAccessException;
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/QueryService.java b/src/main/java/org/eclipse/mdm/api/base/query/QueryService.java
index 4e3f213..6420075 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/QueryService.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/QueryService.java
@@ -1,34 +1,34 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base.query;
-
-/**
- * The {@link QueryService} provides access to the low level query API.
- *
- * A {@link Query}, created by this service, can be used to build and execute
- * queries on the underlying datastore. The results are returned as a list
- * of {@link Result}s.
- *
- * @since 1.0.0
- */
-public interface QueryService {
-
- /**
- * Creates a new and empty {@link Query}.
- *
- * @return Created {@code Query} is returned.
- */
- Query createQuery();
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.query;
+
+/**
+ * The {@link QueryService} provides access to the low level query API.
+ *
+ * A {@link Query}, created by this service, can be used to build and execute
+ * queries on the underlying datastore. The results are returned as a list of
+ * {@link Result}s.
+ *
+ * @since 1.0.0
+ */
+public interface QueryService {
+
+ /**
+ * Creates a new and empty {@link Query}.
+ *
+ * @return Created {@code Query} is returned.
+ */
+ Query createQuery();
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Record.java b/src/main/java/org/eclipse/mdm/api/base/query/Record.java
index 47e685c..d733b76 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Record.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Record.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -49,8 +48,7 @@
/**
* Constructor.
*
- * @param entityType
- * The {@link EntityType} this record is associated with.
+ * @param entityType The {@link EntityType} this record is associated with.
*/
public Record(EntityType entityType) {
this.entityType = entityType;
@@ -79,12 +77,12 @@
}
/**
- * Returns the record ID, which is the ID of the instance, represented by
- * this record.
+ * Returns the record ID, which is the ID of the instance, represented by this
+ * record.
*
* @return Returns the ID of this record.
- * @throws IllegalStateException
- * Thrown if the ID {@code Value} container is not available.
+ * @throws IllegalStateException Thrown if the ID {@code Value} container is not
+ * available.
*/
public String getID() {
Value idValue = getValues().get(getEntityType().getIDAttribute().getName());
@@ -99,12 +97,10 @@
* Returns the instance ID of the related entity referenced by the given
* {@link Relation}.
*
- * @param relation
- * The foreign key {@code Relation}.
+ * @param relation The foreign key {@code Relation}.
* @return {@code Optional} is empty if there is no related entity.
- * @throws IllegalStateException
- * Thrown if the requested foreign key was not selected prior
- * executing the query.
+ * @throws IllegalStateException Thrown if the requested foreign key was not
+ * selected prior executing the query.
*/
public Optional<String> getID(Relation relation) {
Value idValue = getValues().get(relation.getName());
@@ -118,10 +114,9 @@
/**
* Adds given {@link Value} to this record.
*
- * @param value
- * {@link Value} that will be added.
- * @throws IllegalArgumentException
- * Thrown if given {@code Value} overwrites an existing one.
+ * @param value {@link Value} that will be added.
+ * @throws IllegalArgumentException Thrown if given {@code Value} overwrites an
+ * existing one.
*/
public void addValue(Value value) {
if (values.put(value.getName(), value) != null) {
@@ -146,16 +141,13 @@
// ======================================================================
/**
- * Merges given record with this instance. To be able to do so, the given
- * record must be compatible with this record. Records are compatible if the
- * underlying {@link EntityType} and the subset of {@link Value}s is the
- * same.
+ * Merges given record with this instance. To be able to do so, the given record
+ * must be compatible with this record. Records are compatible if the underlying
+ * {@link EntityType} and the subset of {@link Value}s is the same.
*
- * @param record
- * The record that will be merged with this instance.
+ * @param record The record that will be merged with this instance.
* @return A new record with merged {@code Value}s is returned.
- * @throws IllegalArgumentException
- * Thrown if given record is not compatible.
+ * @throws IllegalArgumentException Thrown if given record is not compatible.
*/
Record merge(Record record) {
boolean entityTypeMissmatch = !getEntityType().equals(record.getEntityType());
@@ -172,11 +164,10 @@
/**
* Returns {@link Value} with given name.
*
- * @param name
- * Used as identifier.
+ * @param name Used as identifier.
* @return {@code Value} with given name is returned.
- * @throws IllegalArgumentException
- * Thrown if value with given name is not contained.
+ * @throws IllegalArgumentException Thrown if value with given name is not
+ * contained.
*/
Value getValue(String name) {
Value value = getValues().get(name);
diff --git a/src/main/java/org/eclipse/mdm/api/base/query/Result.java b/src/main/java/org/eclipse/mdm/api/base/query/Result.java
index 8ad4a68..3711ba6 100644
--- a/src/main/java/org/eclipse/mdm/api/base/query/Result.java
+++ b/src/main/java/org/eclipse/mdm/api/base/query/Result.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.query;
@@ -26,7 +25,8 @@
import org.eclipse.mdm.api.base.model.Value;
/**
- * A result consists of one or more {@link Record}s, which is mapped from an {@link EntityType}
+ * A result consists of one or more {@link Record}s, which is mapped from an
+ * {@link EntityType}
*
* @since 1.0.0
* @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
@@ -39,10 +39,9 @@
/**
* Adds given {@link Record} to this result.
*
- * @param record
- * {@code Record} that will be added.
- * @throws IllegalArgumentException
- * Thrown if given {@code Record} overwrites an existing one.
+ * @param record {@code Record} that will be added.
+ * @throws IllegalArgumentException Thrown if given {@code Record} overwrites an
+ * existing one.
*/
public void addRecord(Record record) {
if (records.put(record.getEntityType(), record) != null) {
@@ -54,12 +53,11 @@
/**
* Returns the {@link Record} associated with given {@link EntityType}.
*
- * @param entityType
- * Used as identifier.
+ * @param entityType Used as identifier.
* @return The {@code Record} associated with given {@code EntityType} is
* returned.
- * @throws IllegalArgumentException
- * Thrown if associated {@code Record} does not exist.
+ * @throws IllegalArgumentException Thrown if associated {@code Record} does not
+ * exist.
*/
public Record getRecord(EntityType entityType) {
Record record = records.get(entityType);
@@ -71,15 +69,14 @@
}
/**
- * Removes the {@link Record} associated with given {@link EntityType} from
- * this result and returns it.
+ * Removes the {@link Record} associated with given {@link EntityType} from this
+ * result and returns it.
*
- * @param entityType
- * Used as identifier.
- * @return The removed {@code Record} associated with given
- * {@code EntityType} is returned.
- * @throws IllegalArgumentException
- * Thrown if associated {@code Record} does not exists.
+ * @param entityType Used as identifier.
+ * @return The removed {@code Record} associated with given {@code EntityType}
+ * is returned.
+ * @throws IllegalArgumentException Thrown if associated {@code Record} does not
+ * exists.
*/
public Record removeRecord(EntityType entityType) {
Record record = records.remove(entityType);
@@ -91,25 +88,22 @@
}
/**
- * Returns the {@link Value} container associated with given
- * {@link Attribute} and no aggregation.
+ * Returns the {@link Value} container associated with given {@link Attribute}
+ * and no aggregation.
*
- * @param attribute
- * Used as identifier to find the associated {@code Value}.
+ * @param attribute Used as identifier to find the associated {@code Value}.
* @return Associated {@code Value} is returned.
*/
public Value getValue(Attribute attribute) {
return getValue(attribute, Aggregation.NONE);
}
-
+
/**
* Returns the {@link Value} container associated with given {@link Attribute}
* and {@link Aggregation}.
*
- * @param attribute
- * Used as identifier to find the associated {@code Value}.
- * @param aggregation
- * {@link Aggregation} used with the attribute.
+ * @param attribute Used as identifier to find the associated {@code Value}.
+ * @param aggregation {@link Aggregation} used with the attribute.
* @return Associated {@code Value} is returned.
*/
public Value getValue(Attribute attribute, Aggregation aggregation) {
@@ -124,15 +118,13 @@
}
/**
- * Merges given result with this instance. To be able to do so, the given
- * result must be compatible with this result. Results are compatible if the
- * subset of {@link Record}s is the same.
+ * Merges given result with this instance. To be able to do so, the given result
+ * must be compatible with this result. Results are compatible if the subset of
+ * {@link Record}s is the same.
*
- * @param result
- * The result that will be merged with this instance.
+ * @param result The result that will be merged with this instance.
* @return A new result with merged {@code Record}s is returned.
- * @throws IllegalArgumentException
- * Thrown if given result is not compatible.
+ * @throws IllegalArgumentException Thrown if given result is not compatible.
*/
public Result merge(Result result) {
if (records.size() != result.records.size()) {
diff --git a/src/main/java/org/eclipse/mdm/api/base/search/SearchQuery.java b/src/main/java/org/eclipse/mdm/api/base/search/SearchQuery.java
index d881a6a..3c7f0b9 100644
--- a/src/main/java/org/eclipse/mdm/api/base/search/SearchQuery.java
+++ b/src/main/java/org/eclipse/mdm/api/base/search/SearchQuery.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.search;
@@ -51,26 +50,24 @@
List<EntityType> listEntityTypes();
/**
- * Returns the {@link Searchable}, which describes a hierarchical order of
- * the {@link EntityType}s supported by this search query.
+ * Returns the {@link Searchable}, which describes a hierarchical order of the
+ * {@link EntityType}s supported by this search query.
*
* @return The {@code Searchable} root is returned.
*/
Searchable getSearchableRoot();
/**
- * Returns the distinct {@link Value} sequence for given {@link Attribute}.
- * The {@code Attribute} must be supported by this search query. The
- * returned {@code Value} sequence is intended to be used for building
- * filter criteria for this search query.
+ * Returns the distinct {@link Value} sequence for given {@link Attribute}. The
+ * {@code Attribute} must be supported by this search query. The returned
+ * {@code Value} sequence is intended to be used for building filter criteria
+ * for this search query.
*
- * @param attribute
- * The {@code Attribute} whose distinct values will be queried.
- * @return A distinct {@code List} of all available {@code Value}s is
- * returned.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the distinct {@code Value} sequence.
+ * @param attribute The {@code Attribute} whose distinct values will be queried.
+ * @return A distinct {@code List} of all available {@code Value}s is returned.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the distinct {@code Value}
+ * sequence.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #getFilterValues(Attribute, Filter)
@@ -80,19 +77,17 @@
}
/**
- * Returns the distinct {@link Value} sequence for given {@link Attribute}
- * and {@link Filter}. Both must be fully supported by this search query.
- * The returned {@code Value} sequence is intended to be used for building
- * filter criteria for this search query.
+ * Returns the distinct {@link Value} sequence for given {@link Attribute} and
+ * {@link Filter}. Both must be fully supported by this search query. The
+ * returned {@code Value} sequence is intended to be used for building filter
+ * criteria for this search query.
*
- * @param attribute
- * The {@code Attribute} whose distinct values will be queried.
- * @param filter
- * The criteria sequence.
+ * @param attribute The {@code Attribute} whose distinct values will be queried.
+ * @param filter The criteria sequence.
* @return A distinct {@code List} of {@code Value}s is returned.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the distinct {@code Value} sequence.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the distinct {@code Value}
+ * sequence.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #getFilterValues(Attribute)
@@ -104,13 +99,11 @@
* EntityType}s must be fully supported by this search query. This method
* selects all {@link Attribute}s of each given {@code EntityType}.
*
- * @param entityTypes
- * Select statements will be added for all {@code Attribute}s of
- * each given {@code EntityType}.
+ * @param entityTypes Select statements will be added for all {@code Attribute}s
+ * of each given {@code EntityType}.
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #fetchComplete(List, Filter)
@@ -121,19 +114,16 @@
}
/**
- * Executes this search query with given {@link EntityType}s and
- * {@link Filter}. Both must be fully supported by this search query. This
- * method selects all {@link Attribute}s of each given {@code EntityType}.
+ * Executes this search query with given {@link EntityType}s and {@link Filter}.
+ * Both must be fully supported by this search query. This method selects all
+ * {@link Attribute}s of each given {@code EntityType}.
*
- * @param entityTypes
- * Select statements will be added for all {@code Attribute}s of
- * each given {@code EntityType}.
- * @param filter
- * The criteria sequence.
+ * @param entityTypes Select statements will be added for all {@code Attribute}s
+ * of each given {@code EntityType}.
+ * @param filter The criteria sequence.
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #fetchComplete(List)
@@ -143,16 +133,14 @@
/**
* Executes this search query with given {@link Attribute}s. The {@code
- * Attribute}s must be fully supported by this search query. This method
- * allows fine grained {@link Result} configuration.
+ * Attribute}s must be fully supported by this search query. This method allows
+ * fine grained {@link Result} configuration.
*
- * @param attributes
- * Select statements will be added for each {@code
+ * @param attributes Select statements will be added for each {@code
* Attribute}.
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #fetch(List, Filter)
@@ -163,19 +151,16 @@
}
/**
- * Executes this search query with given {@link Attribute}s and
- * {@link Filter}. Both must be fully supported by this search query. This
- * method allows fine grained {@link Result} configuration.
+ * Executes this search query with given {@link Attribute}s and {@link Filter}.
+ * Both must be fully supported by this search query. This method allows fine
+ * grained {@link Result} configuration.
*
- * @param attributes
- * Select statements will be added for each {@code
+ * @param attributes Select statements will be added for each {@code
* Attribute}.
- * @param filter
- * The criteria sequence.
+ * @param filter The criteria sequence.
* @return All {@code Result}s are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the {@code Result}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the {@code Result}s.
* @see #getSearchableRoot()
* @see #listEntityTypes()
* @see #fetch(List)
diff --git a/src/main/java/org/eclipse/mdm/api/base/search/SearchService.java b/src/main/java/org/eclipse/mdm/api/base/search/SearchService.java
index 6337df7..d120014 100644
--- a/src/main/java/org/eclipse/mdm/api/base/search/SearchService.java
+++ b/src/main/java/org/eclipse/mdm/api/base/search/SearchService.java
@@ -1,404 +1,371 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.search;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.mdm.api.base.adapter.Attribute;
-import org.eclipse.mdm.api.base.adapter.EntityType;
-import org.eclipse.mdm.api.base.adapter.Relation;
-import org.eclipse.mdm.api.base.model.Entity;
-import org.eclipse.mdm.api.base.model.Value;
-import org.eclipse.mdm.api.base.query.DataAccessException;
-import org.eclipse.mdm.api.base.query.Filter;
-import org.eclipse.mdm.api.base.query.Record;
-import org.eclipse.mdm.api.base.query.Result;
-
-/**
- * This search service uses given {@link Entity} type to execute the associated
- * predefined {@link SearchQuery} and returns the results.
- *
- * @since 1.0.0
- * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
- * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
- * @see EntityType
- * @see Searchable
- * @see Attribute
- * @see Value
- * @see Filter
- * @see Result
- */
-public interface SearchService {
-
- /**
- * Returns all {@link Entity} types this search service provides a
- * predefined {@link SearchQuery} for.
- *
- * @return The returned {@code List} with supported types may be immutable.
- */
- List<Class<? extends Entity>> listSearchableTypes();
-
- /**
- * Returns all {@link EntityType}s supported by the {@link SearchQuery}
- * associated with given {@link Entity} type.
- *
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @return The returned {@code List} may be immutable.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- */
- List<EntityType> listEntityTypes(Class<? extends Entity> entityClass);
-
- /**
- * Returns the {@link Searchable}, which describes a hierarchical order of
- * the {@link EntityType}s supported by the {@link SearchQuery} associated
- * with given {@link Entity} type.
- *
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @return The {@code Searchable} root is returned.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- */
- Searchable getSearchableRoot(Class<? extends Entity> entityClass);
-
- /**
- * Returns the distinct {@link Value} sequence for given {@link Attribute}.
- * The {@code Attribute} must be supported by the {@link SearchQuery}
- * associated with given {@link Entity} type. The returned {@code Value}
- * sequence is intended to be used for building filter criteria.
- *
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param attribute
- * The {@code Attribute} whose distinct values will be queried.
- * @return A distinct {@code List} of all available {@code Value}s is
- * returned.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the distinct {@code Value} sequence.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #getFilterValues(Class, Attribute, Filter)
- */
- default List<Value> getFilterValues(Class<? extends Entity> entityClass, Attribute attribute)
- throws DataAccessException {
- return getFilterValues(entityClass, attribute, Filter.and());
- }
-
- /**
- * Returns the distinct {@link Value} sequence for given {@link Attribute}
- * and {@link Filter}. Both must be fully supported by the
- * {@link SearchQuery} associated with given {@link Entity} type. The
- * returned {@code Value} sequence is intended to be used for building
- * filter criteria.
- *
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param attribute
- * The {@code Attribute} whose distinct values will be queried.
- * @param filter
- * The criteria sequence.
- * @return A distinct {@code List} of {@code Value}s is returned.
- * @throws DataAccessException
- * Thrown in case of errors while executing the query or
- * generating the distinct {@code Value} sequence.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #getFilterValues(Class, Attribute)
- */
- List<Value> getFilterValues(Class<? extends Entity> entityClass, Attribute attribute, Filter filter)
- throws DataAccessException;
-
- /**
- * Executes the associated {@link SearchQuery} with given
- * {@link EntityType}s. The {@code EntityType}s must be fully supported by
- * the {@code SearchQuery} associated with given {@link Entity} type. This
- * method selects all {@link Attribute}s of each given {@code EntityType}.
- *
- * It is only guaranteed that this method loads the selected entities,
- * and their relations among themselves. No information about additional related entities
- * is necessarily loaded.
- *
- * <p>
- * <b>Note:</b> Related {@code Record}s may be merged according to the
- * cardinality of the associated {@link Relation}.
- *
- * @param <T>
- * Type of the entities that will be generated for each result.
- * @param entityCass
- * Used as the {@code SearchQuery} identifier.
- * @param entityTypes
- * Select statements will be added for all {@code Attribute}s of
- * each given {@code EntityType}.
- * @return All matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #fetch(Class, List)
- * @see Record#merge(Record)
- */
- default <T extends Entity> List<T> fetchComplete(Class<T> entityCass, List<EntityType> entityTypes)
- throws DataAccessException {
- return fetchComplete(entityCass, entityTypes, Filter.and());
- }
-
- /**
- * Executes the associated {@link SearchQuery} with given
- * {@link EntityType}s and {@link Filter}. Both must be fully supported by
- * the {@code SearchQuery} associated with given {@link Entity} type. This
- * method selects all {@link Attribute}s of each given {@code EntityType}.
- *
- * It is only guaranteed that this method loads the selected entities,
- * and their relations among themselves. No information about additional related entities
- * is necessarily loaded.
- *
- * <p>
- * <b>Note:</b> Related {@code Record}s may be merged according to the
- * cardinality of the associated {@link Relation}.
- *
- * @param <T>
- * Type of the entities that will be generated for each. result.
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param entityTypes
- * Select statements will be added for all {@code Attribute}s of
- * each given {@code EntityType}.
- * @param filter
- * The criteria sequence.
- * @return All matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #fetch(Class, List, Filter)
- * @see Record#merge(Record)
- */
- <T extends Entity> List<T> fetchComplete(Class<T> entityClass, List<EntityType> entityTypes, Filter filter)
- throws DataAccessException;
-
- /**
- * Executes the associated {@link SearchQuery} and returns all available
- * instances of the specified {@link Entity} type.
- *
- * It is only guaranteed that this method loads the selected entity,
- * no information about related entities is necessarily loaded.
- *
- * @param <T>
- * Type of the entities that will be generated for each result.
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @return All available entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #fetch(Class, Filter)
- */
- default <T extends Entity> List<T> fetch(Class<T> entityClass) throws DataAccessException {
- return fetch(entityClass, Filter.and());
- }
-
- /**
- * Executes the associated {@link SearchQuery} with given {@link Filter}.
- * The {@code Filter} must be fully supported by the {@code SearchQuery}
- * associated with given {@link Entity} type.
- * It is only guaranteed that this method loads the selected entity,
- * no information about related entities is necessarily loaded.
- *
- *
- * @param <T>
- * Type of the entities that will be generated for each result.
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param filter
- * The criteria sequence.
- * @return All matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #fetch(Class)
- */
- default <T extends Entity> List<T> fetch(Class<T> entityClass, Filter filter) throws DataAccessException {
- return fetch(entityClass, Collections.emptyList(), filter);
- }
-
- /**
- * Executes the associated {@link SearchQuery} with given
- * {@link Attribute}s. The {@code Attribute}s must be fully supported by the
- * {@code SearchQuery} associated with given {@link Entity} type. This
- * method allows fine grained {@link Record} configuration.
- *
- * It is only guaranteed that this method loads the selected entity or attributes,
- * no additional information about related entities is necessarily loaded.
- *
- * <p>
- * <b>Note:</b> Related {@code Record}s may be merged according to the
- * cardinality of the associated {@link Relation}.
- *
- * @param <T>
- * Type of the entities that will be generated for each result.
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param attributes
- * Select statements will be added for each {@code
- * Attribute}.
- * @return All matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #fetchComplete(Class, List)
- * @see Record#merge(Record)
- */
- default <T extends Entity> List<T> fetch(Class<T> entityClass, List<Attribute> attributes)
- throws DataAccessException {
- return fetch(entityClass, attributes, Filter.and());
- }
-
- /**
- * Executes the associated {@link SearchQuery} with given {@link Attribute}s
- * and {@link Filter}. Both must be fully supported by the
- * {@code SearchQuery} associated with given {@link Entity} type. This
- * method allows fine grained {@link Record} configuration.
- *
- * It is only guaranteed that this method loads the selected entity or attributes,
- * no additional information about related entities is necessarily loaded.
- *
- * <p>
- * <b>Note:</b> Related {@code Record}s may be merged according to the
- * cardinality of the associated {@link Relation}.
- *
- * @param <T>
- * Type of the entities that will be generated for each result.
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param attributes
- * Select statements will be added for each {@code
- * Attribute}.
- * @param filter
- * The criteria sequence.
- * @return All matched entities are returned in a {@code List}.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see #fetchComplete(Class, List, Filter)
- * @see Record#merge(Record)
- */
- <T extends Entity> List<T> fetch(Class<T> entityClass, List<Attribute> attributes, Filter filter)
- throws DataAccessException;
-
- /**
- * Executes the associated {@link SearchQuery} with given {@link Attribute}s
- * and {@link Filter}. Both must be fully supported by the
- * {@code SearchQuery} associated with given {@link Entity} type. This
- * method allows fine grained {@link Record} configuration. This method
- * allows to specify a fulltext search query string.
- *
- * It is only guaranteed that this method loads the selected entity or attributes,
- * no additional information about related entities is necessarily loaded.
- *
- * <p>
- * <b>Note:</b> Related {@code Record}s may be merged according to the
- * cardinality of the associated {@link Relation}.
- *
- * @param entityClass
- * Used as the {@code SearchQuery} identifier.
- * @param attributes
- * Select statements will be added for each {@code
- * Attribute}.
- * @param filter
- * The criteria sequence.
- * @param query
- * The fulltext search query
- * @return All {@link Result}s found by the {@link SearchQuery} with given
- * {@link Attribute}s.
- * @throws DataAccessException
- * Thrown in case of errors while executing the
- * {@code SearchQuery} or analyzing its {@code Result}s.
- * @throws IllegalArgumentException
- * Thrown if given type is not associated with a predefined
- * {@code SearchQuery}.
- * @see #listSearchableTypes()
- * @see #getSearchableRoot(Class)
- * @see #listEntityTypes(Class)
- * @see Record#merge(Record)
- */
- default List<Result> fetchResults(Class<? extends Entity> entityClass, List<Attribute> attributes, Filter filter,
- String query) throws DataAccessException {
- throw new UnsupportedOperationException();
- }
-
- default boolean isTextSearchAvailable() {
- return false;
- }
-
- @SuppressWarnings("unchecked")
- default <T extends Entity> List<T> fetch(Class<T> entityClass, String query) throws DataAccessException {
- return (List<T>) fetch(query).getOrDefault(entityClass, Collections.emptyList());
- }
-
- default Map<Class<? extends Entity>, List<Entity>> fetch(String query) throws DataAccessException {
- throw new UnsupportedOperationException();
- }
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.search;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.adapter.Attribute;
+import org.eclipse.mdm.api.base.adapter.EntityType;
+import org.eclipse.mdm.api.base.adapter.Relation;
+import org.eclipse.mdm.api.base.model.Entity;
+import org.eclipse.mdm.api.base.model.Value;
+import org.eclipse.mdm.api.base.query.DataAccessException;
+import org.eclipse.mdm.api.base.query.Filter;
+import org.eclipse.mdm.api.base.query.Record;
+import org.eclipse.mdm.api.base.query.Result;
+
+/**
+ * This search service uses given {@link Entity} type to execute the associated
+ * predefined {@link SearchQuery} and returns the results.
+ *
+ * @since 1.0.0
+ * @author Viktor Stoehr, Gigatronik Ingolstadt GmbH
+ * @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
+ * @see EntityType
+ * @see Searchable
+ * @see Attribute
+ * @see Value
+ * @see Filter
+ * @see Result
+ */
+public interface SearchService {
+
+ /**
+ * Returns all {@link Entity} types this search service provides a predefined
+ * {@link SearchQuery} for.
+ *
+ * @return The returned {@code List} with supported types may be immutable.
+ */
+ List<Class<? extends Entity>> listSearchableTypes();
+
+ /**
+ * Returns all {@link EntityType}s supported by the {@link SearchQuery}
+ * associated with given {@link Entity} type.
+ *
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @return The returned {@code List} may be immutable.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ */
+ List<EntityType> listEntityTypes(Class<? extends Entity> entityClass);
+
+ /**
+ * Returns the {@link Searchable}, which describes a hierarchical order of the
+ * {@link EntityType}s supported by the {@link SearchQuery} associated with
+ * given {@link Entity} type.
+ *
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @return The {@code Searchable} root is returned.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ */
+ Searchable getSearchableRoot(Class<? extends Entity> entityClass);
+
+ /**
+ * Returns the distinct {@link Value} sequence for given {@link Attribute}. The
+ * {@code Attribute} must be supported by the {@link SearchQuery} associated
+ * with given {@link Entity} type. The returned {@code Value} sequence is
+ * intended to be used for building filter criteria.
+ *
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param attribute The {@code Attribute} whose distinct values will be
+ * queried.
+ * @return A distinct {@code List} of all available {@code Value}s is returned.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the distinct
+ * {@code Value} sequence.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #getFilterValues(Class, Attribute, Filter)
+ */
+ default List<Value> getFilterValues(Class<? extends Entity> entityClass, Attribute attribute)
+ throws DataAccessException {
+ return getFilterValues(entityClass, attribute, Filter.and());
+ }
+
+ /**
+ * Returns the distinct {@link Value} sequence for given {@link Attribute} and
+ * {@link Filter}. Both must be fully supported by the {@link SearchQuery}
+ * associated with given {@link Entity} type. The returned {@code Value}
+ * sequence is intended to be used for building filter criteria.
+ *
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param attribute The {@code Attribute} whose distinct values will be
+ * queried.
+ * @param filter The criteria sequence.
+ * @return A distinct {@code List} of {@code Value}s is returned.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * query or generating the distinct
+ * {@code Value} sequence.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #getFilterValues(Class, Attribute)
+ */
+ List<Value> getFilterValues(Class<? extends Entity> entityClass, Attribute attribute, Filter filter)
+ throws DataAccessException;
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link EntityType}s.
+ * The {@code EntityType}s must be fully supported by the {@code SearchQuery}
+ * associated with given {@link Entity} type. This method selects all
+ * {@link Attribute}s of each given {@code EntityType}.
+ *
+ * It is only guaranteed that this method loads the selected entities, and their
+ * relations among themselves. No information about additional related entities
+ * is necessarily loaded.
+ *
+ * <p>
+ * <b>Note:</b> Related {@code Record}s may be merged according to the
+ * cardinality of the associated {@link Relation}.
+ *
+ * @param <T> Type of the entities that will be generated for each
+ * result.
+ * @param entityCass Used as the {@code SearchQuery} identifier.
+ * @param entityTypes Select statements will be added for all {@code Attribute}s
+ * of each given {@code EntityType}.
+ * @return All matched entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #fetch(Class, List)
+ * @see Record#merge(Record)
+ */
+ default <T extends Entity> List<T> fetchComplete(Class<T> entityCass, List<EntityType> entityTypes)
+ throws DataAccessException {
+ return fetchComplete(entityCass, entityTypes, Filter.and());
+ }
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link EntityType}s
+ * and {@link Filter}. Both must be fully supported by the {@code SearchQuery}
+ * associated with given {@link Entity} type. This method selects all
+ * {@link Attribute}s of each given {@code EntityType}.
+ *
+ * It is only guaranteed that this method loads the selected entities, and their
+ * relations among themselves. No information about additional related entities
+ * is necessarily loaded.
+ *
+ * <p>
+ * <b>Note:</b> Related {@code Record}s may be merged according to the
+ * cardinality of the associated {@link Relation}.
+ *
+ * @param <T> Type of the entities that will be generated for each.
+ * result.
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param entityTypes Select statements will be added for all {@code Attribute}s
+ * of each given {@code EntityType}.
+ * @param filter The criteria sequence.
+ * @return All matched entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #fetch(Class, List, Filter)
+ * @see Record#merge(Record)
+ */
+ <T extends Entity> List<T> fetchComplete(Class<T> entityClass, List<EntityType> entityTypes, Filter filter)
+ throws DataAccessException;
+
+ /**
+ * Executes the associated {@link SearchQuery} and returns all available
+ * instances of the specified {@link Entity} type.
+ *
+ * It is only guaranteed that this method loads the selected entity, no
+ * information about related entities is necessarily loaded.
+ *
+ * @param <T> Type of the entities that will be generated for each
+ * result.
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @return All available entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #fetch(Class, Filter)
+ */
+ default <T extends Entity> List<T> fetch(Class<T> entityClass) throws DataAccessException {
+ return fetch(entityClass, Filter.and());
+ }
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link Filter}. The
+ * {@code Filter} must be fully supported by the {@code SearchQuery} associated
+ * with given {@link Entity} type. It is only guaranteed that this method loads
+ * the selected entity, no information about related entities is necessarily
+ * loaded.
+ *
+ *
+ * @param <T> Type of the entities that will be generated for each
+ * result.
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param filter The criteria sequence.
+ * @return All matched entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #fetch(Class)
+ */
+ default <T extends Entity> List<T> fetch(Class<T> entityClass, Filter filter) throws DataAccessException {
+ return fetch(entityClass, Collections.emptyList(), filter);
+ }
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link Attribute}s.
+ * The {@code Attribute}s must be fully supported by the {@code SearchQuery}
+ * associated with given {@link Entity} type. This method allows fine grained
+ * {@link Record} configuration.
+ *
+ * It is only guaranteed that this method loads the selected entity or
+ * attributes, no additional information about related entities is necessarily
+ * loaded.
+ *
+ * <p>
+ * <b>Note:</b> Related {@code Record}s may be merged according to the
+ * cardinality of the associated {@link Relation}.
+ *
+ * @param <T> Type of the entities that will be generated for each
+ * result.
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param attributes Select statements will be added for each {@code
+ * Attribute} .
+ * @return All matched entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #fetchComplete(Class, List)
+ * @see Record#merge(Record)
+ */
+ default <T extends Entity> List<T> fetch(Class<T> entityClass, List<Attribute> attributes)
+ throws DataAccessException {
+ return fetch(entityClass, attributes, Filter.and());
+ }
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link Attribute}s and
+ * {@link Filter}. Both must be fully supported by the {@code SearchQuery}
+ * associated with given {@link Entity} type. This method allows fine grained
+ * {@link Record} configuration.
+ *
+ * It is only guaranteed that this method loads the selected entity or
+ * attributes, no additional information about related entities is necessarily
+ * loaded.
+ *
+ * <p>
+ * <b>Note:</b> Related {@code Record}s may be merged according to the
+ * cardinality of the associated {@link Relation}.
+ *
+ * @param <T> Type of the entities that will be generated for each
+ * result.
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param attributes Select statements will be added for each {@code
+ * Attribute} .
+ * @param filter The criteria sequence.
+ * @return All matched entities are returned in a {@code List}.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see #fetchComplete(Class, List, Filter)
+ * @see Record#merge(Record)
+ */
+ <T extends Entity> List<T> fetch(Class<T> entityClass, List<Attribute> attributes, Filter filter)
+ throws DataAccessException;
+
+ /**
+ * Executes the associated {@link SearchQuery} with given {@link Attribute}s and
+ * {@link Filter}. Both must be fully supported by the {@code SearchQuery}
+ * associated with given {@link Entity} type. This method allows fine grained
+ * {@link Record} configuration. This method allows to specify a fulltext search
+ * query string.
+ *
+ * It is only guaranteed that this method loads the selected entity or
+ * attributes, no additional information about related entities is necessarily
+ * loaded.
+ *
+ * <p>
+ * <b>Note:</b> Related {@code Record}s may be merged according to the
+ * cardinality of the associated {@link Relation}.
+ *
+ * @param entityClass Used as the {@code SearchQuery} identifier.
+ * @param attributes Select statements will be added for each {@code
+ * Attribute} .
+ * @param filter The criteria sequence.
+ * @param query The fulltext search query
+ * @return All {@link Result}s found by the {@link SearchQuery} with given
+ * {@link Attribute}s.
+ * @throws DataAccessException Thrown in case of errors while executing the
+ * {@code SearchQuery} or analyzing its
+ * {@code Result}s.
+ * @throws IllegalArgumentException Thrown if given type is not associated with
+ * a predefined {@code SearchQuery}.
+ * @see #listSearchableTypes()
+ * @see #getSearchableRoot(Class)
+ * @see #listEntityTypes(Class)
+ * @see Record#merge(Record)
+ */
+ default List<Result> fetchResults(Class<? extends Entity> entityClass, List<Attribute> attributes, Filter filter,
+ String query) throws DataAccessException {
+ throw new UnsupportedOperationException();
+ }
+
+ default boolean isTextSearchAvailable() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ default <T extends Entity> List<T> fetch(Class<T> entityClass, String query) throws DataAccessException {
+ return (List<T>) fetch(query).getOrDefault(entityClass, Collections.emptyList());
+ }
+
+ default Map<Class<? extends Entity>, List<Entity>> fetch(String query) throws DataAccessException {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/main/java/org/eclipse/mdm/api/base/search/Searchable.java b/src/main/java/org/eclipse/mdm/api/base/search/Searchable.java
index e1bb19b..1d41b03 100644
--- a/src/main/java/org/eclipse/mdm/api/base/search/Searchable.java
+++ b/src/main/java/org/eclipse/mdm/api/base/search/Searchable.java
@@ -1,17 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.search;
@@ -45,8 +44,7 @@
/**
* Returns the {@link EntityType} represented by this searchable.
*
- * @return The {@code EntityType} represented by this searchable is
- * returned.
+ * @return The {@code EntityType} represented by this searchable is returned.
*/
EntityType getEntityType();
diff --git a/src/test/java/org/eclipse/mdm/api/base/AttributeImpl.java b/src/test/java/org/eclipse/mdm/api/base/AttributeImpl.java
index b0fecf2..5fd3f67 100755
--- a/src/test/java/org/eclipse/mdm/api/base/AttributeImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/AttributeImpl.java
@@ -1,64 +1,63 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base;
-
-import org.eclipse.mdm.api.base.adapter.Attribute;
-import org.eclipse.mdm.api.base.adapter.EntityType;
-import org.eclipse.mdm.api.base.model.Enumeration;
-import org.eclipse.mdm.api.base.model.ValueType;
-
-public class AttributeImpl implements Attribute {
-
- public enum Type {
- ID, UNKNOWN;
- }
-
- Type type;
-
- public AttributeImpl(Type type) {
- this.type = type;
- }
-
- @Override
- public EntityType getEntityType() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getName() {
- return type.name();
- }
-
- @Override
- public String getUnit() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ValueType getValueType() {
- switch (type) {
- case ID:
- return ValueType.STRING;
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- @Override
- public Enumeration<?> getEnumObj() {
- throw new UnsupportedOperationException();
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+import org.eclipse.mdm.api.base.adapter.Attribute;
+import org.eclipse.mdm.api.base.adapter.EntityType;
+import org.eclipse.mdm.api.base.model.Enumeration;
+import org.eclipse.mdm.api.base.model.ValueType;
+
+public class AttributeImpl implements Attribute {
+
+ public enum Type {
+ ID, UNKNOWN;
+ }
+
+ Type type;
+
+ public AttributeImpl(Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public EntityType getEntityType() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getName() {
+ return type.name();
+ }
+
+ @Override
+ public String getUnit() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ValueType getValueType() {
+ switch (type) {
+ case ID:
+ return ValueType.STRING;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ @Override
+ public Enumeration<?> getEnumObj() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/src/test/java/org/eclipse/mdm/api/base/BaseEntityManagerTest.java b/src/test/java/org/eclipse/mdm/api/base/BaseEntityManagerTest.java
index a6de1ca..935fc57 100644
--- a/src/test/java/org/eclipse/mdm/api/base/BaseEntityManagerTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/BaseEntityManagerTest.java
@@ -1,74 +1,76 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base;
-
-import org.eclipse.mdm.api.base.model.TestStep;
-import org.eclipse.mdm.api.base.query.DataAccessException;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.*;
-
-public class BaseEntityManagerTest {
-
- @Test
- public void loadShouldReturnEntity() throws DataAccessException {
-
- @SuppressWarnings("unchecked")
- BaseEntityManager entityManager = mock(BaseEntityManager.class);
- TestStep mockedTestStep = mock(TestStep.class);
-
- when(entityManager.load(any(), anyString())).thenCallRealMethod();
- when(entityManager.load(TestStep.class, Arrays.asList("id1"))).thenReturn(Arrays.asList(mockedTestStep));
-
- assertThat(entityManager.load(TestStep.class, "id1"))
- .isEqualTo(mockedTestStep);
- }
-
- @Test
- public void loadNotExistingIdShouldThrowDataAccessException() throws DataAccessException {
-
- @SuppressWarnings("unchecked")
- BaseEntityManager entityManager = mock(BaseEntityManager.class);
-
- when(entityManager.load(any(), anyString())).thenCallRealMethod();
- when(entityManager.load(eq(TestStep.class), anyCollection())).thenReturn(Collections.<TestStep>emptyList());
-
- assertThatThrownBy(() -> entityManager.load(TestStep.class, "xyz"))
- .isInstanceOf(DataAccessException.class)
- .hasMessageContaining("Failed to load entity by instance ID.");
- }
-
- @Test
- public void loadNotUniqueIdShouldThrowDataAccessException() throws DataAccessException {
-
- @SuppressWarnings("unchecked")
- BaseEntityManager entityManager = mock(BaseEntityManager.class);
- TestStep mockedTestStep1 = mock(TestStep.class);
- TestStep mockedTestStep2 = mock(TestStep.class);
-
- when(entityManager.load(any(), anyString())).thenCallRealMethod();
- when(entityManager.load(TestStep.class, Arrays.asList("id1")))
- .thenReturn(Arrays.asList(mockedTestStep1, mockedTestStep2));
-
- assertThatThrownBy(() -> entityManager.load(TestStep.class, "id1"))
- .isInstanceOf(DataAccessException.class)
- .hasMessageContaining("Failed to load entity by instance ID.");
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyCollection;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.eclipse.mdm.api.base.model.TestStep;
+import org.eclipse.mdm.api.base.query.DataAccessException;
+import org.junit.Test;
+
+public class BaseEntityManagerTest {
+
+ @Test
+ public void loadShouldReturnEntity() throws DataAccessException {
+
+ @SuppressWarnings("unchecked")
+ BaseEntityManager entityManager = mock(BaseEntityManager.class);
+ TestStep mockedTestStep = mock(TestStep.class);
+
+ when(entityManager.load(any(), anyString())).thenCallRealMethod();
+ when(entityManager.load(TestStep.class, Arrays.asList("id1"))).thenReturn(Arrays.asList(mockedTestStep));
+
+ assertThat(entityManager.load(TestStep.class, "id1")).isEqualTo(mockedTestStep);
+ }
+
+ @Test
+ public void loadNotExistingIdShouldThrowDataAccessException() throws DataAccessException {
+
+ @SuppressWarnings("unchecked")
+ BaseEntityManager entityManager = mock(BaseEntityManager.class);
+
+ when(entityManager.load(any(), anyString())).thenCallRealMethod();
+ when(entityManager.load(eq(TestStep.class), anyCollection())).thenReturn(Collections.<TestStep>emptyList());
+
+ assertThatThrownBy(() -> entityManager.load(TestStep.class, "xyz")).isInstanceOf(DataAccessException.class)
+ .hasMessageContaining("Failed to load entity by instance ID.");
+ }
+
+ @Test
+ public void loadNotUniqueIdShouldThrowDataAccessException() throws DataAccessException {
+
+ @SuppressWarnings("unchecked")
+ BaseEntityManager entityManager = mock(BaseEntityManager.class);
+ TestStep mockedTestStep1 = mock(TestStep.class);
+ TestStep mockedTestStep2 = mock(TestStep.class);
+
+ when(entityManager.load(any(), anyString())).thenCallRealMethod();
+ when(entityManager.load(TestStep.class, Arrays.asList("id1")))
+ .thenReturn(Arrays.asList(mockedTestStep1, mockedTestStep2));
+
+ assertThatThrownBy(() -> entityManager.load(TestStep.class, "id1")).isInstanceOf(DataAccessException.class)
+ .hasMessageContaining("Failed to load entity by instance ID.");
+ }
+}
diff --git a/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java b/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
index 895c17b..d5545d7 100755
--- a/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/CoreImpl.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base;
import java.util.Collection;
diff --git a/src/test/java/org/eclipse/mdm/api/base/EntityFactoryImpl.java b/src/test/java/org/eclipse/mdm/api/base/EntityFactoryImpl.java
index 7c1ca1f..4eabb3d 100755
--- a/src/test/java/org/eclipse/mdm/api/base/EntityFactoryImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/EntityFactoryImpl.java
@@ -1,62 +1,61 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base;
-
-import java.util.Optional;
-
-import org.eclipse.mdm.api.base.adapter.Core;
-import org.eclipse.mdm.api.base.model.BaseEntityFactory;
-import org.eclipse.mdm.api.base.model.ContextType;
-import org.eclipse.mdm.api.base.model.Entity;
-import org.eclipse.mdm.api.base.model.User;
-
-/**
- *
- * Very basic implementation of BaseEntityFactory for testing purposes. We
- * deliver a core containing data on initialization to simulate other data
- * sources.
- *
- * @author Florian Schmitt
- *
- */
-public class EntityFactoryImpl extends BaseEntityFactory {
-
- private Core core;
-
- public EntityFactoryImpl(Core core) {
- this.core = core;
- }
-
- @Override
- protected Optional<User> getLoggedInUser() {
- return Optional.ofNullable(null);
- }
-
- @Override
- protected <T extends Entity> Core createCore(Class<T> entityClass) {
- return core;
- }
-
- @Override
- protected <T extends Entity> Core createCore(Class<T> entityClass, ContextType contextType) {
- return core;
- }
-
- @Override
- protected <T extends Entity> Core createCore(String name, Class<T> entityClass) {
- return core;
- }
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+import java.util.Optional;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntityFactory;
+import org.eclipse.mdm.api.base.model.ContextType;
+import org.eclipse.mdm.api.base.model.Entity;
+import org.eclipse.mdm.api.base.model.User;
+
+/**
+ *
+ * Very basic implementation of BaseEntityFactory for testing purposes. We
+ * deliver a core containing data on initialization to simulate other data
+ * sources.
+ *
+ * @author Florian Schmitt
+ *
+ */
+public class EntityFactoryImpl extends BaseEntityFactory {
+
+ private Core core;
+
+ public EntityFactoryImpl(Core core) {
+ this.core = core;
+ }
+
+ @Override
+ protected Optional<User> getLoggedInUser() {
+ return Optional.ofNullable(null);
+ }
+
+ @Override
+ protected <T extends Entity> Core createCore(Class<T> entityClass) {
+ return core;
+ }
+
+ @Override
+ protected <T extends Entity> Core createCore(Class<T> entityClass, ContextType contextType) {
+ return core;
+ }
+
+ @Override
+ protected <T extends Entity> Core createCore(String name, Class<T> entityClass) {
+ return core;
+ }
}
\ No newline at end of file
diff --git a/src/test/java/org/eclipse/mdm/api/base/EntityTypeImpl.java b/src/test/java/org/eclipse/mdm/api/base/EntityTypeImpl.java
index 6ca001f..c7dce19 100755
--- a/src/test/java/org/eclipse/mdm/api/base/EntityTypeImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/EntityTypeImpl.java
@@ -1,93 +1,92 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base;
-
-import java.util.List;
-
-import org.eclipse.mdm.api.base.AttributeImpl.Type;
-import org.eclipse.mdm.api.base.adapter.Attribute;
-import org.eclipse.mdm.api.base.adapter.EntityType;
-import org.eclipse.mdm.api.base.adapter.Relation;
-import org.eclipse.mdm.api.base.adapter.RelationType;
-
-public class EntityTypeImpl implements EntityType {
-
- @Override
- public String getSourceName() {
- return null;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public String getId() {
- return "0";
- }
-
- @Override
- public List<Attribute> getAttributes() {
- return null;
- }
-
- @Override
- public Attribute getIDAttribute() {
- return new AttributeImpl(Type.ID);
- }
-
- @Override
- public Attribute getAttribute(String name) {
- return null;
- }
-
- @Override
- public List<Relation> getRelations() {
- return null;
- }
-
- @Override
- public List<Relation> getParentRelations() {
- return null;
- }
-
- @Override
- public List<Relation> getChildRelations() {
- return null;
- }
-
- @Override
- public List<Relation> getInfoRelations() {
- return null;
- }
-
- @Override
- public List<Relation> getRelations(RelationType relationType) {
- return null;
- }
-
- @Override
- public Relation getRelation(EntityType target) {
- return null;
- }
-
- @Override
- public Relation getRelation(EntityType target, String name) {
- return null;
- }
-
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base;
+
+import java.util.List;
+
+import org.eclipse.mdm.api.base.AttributeImpl.Type;
+import org.eclipse.mdm.api.base.adapter.Attribute;
+import org.eclipse.mdm.api.base.adapter.EntityType;
+import org.eclipse.mdm.api.base.adapter.Relation;
+import org.eclipse.mdm.api.base.adapter.RelationType;
+
+public class EntityTypeImpl implements EntityType {
+
+ @Override
+ public String getSourceName() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public String getId() {
+ return "0";
+ }
+
+ @Override
+ public List<Attribute> getAttributes() {
+ return null;
+ }
+
+ @Override
+ public Attribute getIDAttribute() {
+ return new AttributeImpl(Type.ID);
+ }
+
+ @Override
+ public Attribute getAttribute(String name) {
+ return null;
+ }
+
+ @Override
+ public List<Relation> getRelations() {
+ return null;
+ }
+
+ @Override
+ public List<Relation> getParentRelations() {
+ return null;
+ }
+
+ @Override
+ public List<Relation> getChildRelations() {
+ return null;
+ }
+
+ @Override
+ public List<Relation> getInfoRelations() {
+ return null;
+ }
+
+ @Override
+ public List<Relation> getRelations(RelationType relationType) {
+ return null;
+ }
+
+ @Override
+ public Relation getRelation(EntityType target) {
+ return null;
+ }
+
+ @Override
+ public Relation getRelation(EntityType target, String name) {
+ return null;
+ }
+
+}
diff --git a/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java b/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
index 5df7172..efad3ce 100755
--- a/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
+++ b/src/test/java/org/eclipse/mdm/api/base/RelationImpl.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base;
import org.eclipse.mdm.api.base.adapter.Attribute;
diff --git a/src/test/java/org/eclipse/mdm/api/base/model/ContextComponentTest.java b/src/test/java/org/eclipse/mdm/api/base/model/ContextComponentTest.java
index 9f8d9cd..c2df1d8 100644
--- a/src/test/java/org/eclipse/mdm/api/base/model/ContextComponentTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/model/ContextComponentTest.java
@@ -1,59 +1,59 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base.model;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.mdm.api.base.adapter.ChildrenStore;
-import org.eclipse.mdm.api.base.adapter.Core;
-import org.eclipse.mdm.api.base.adapter.EntityStore;
-
-public class ContextComponentTest {
-
- @org.junit.Test
- public void testGetContextRoot() {
- BaseEntityFactory factory = spy(BaseEntityFactory.class);
- Core rootCore = createCore("UNITUNDERTEST");
- when(factory.createCore(ContextRoot.class, ContextType.UNITUNDERTEST)).thenReturn(rootCore);
- Core componentCore = createCore("");
- when(factory.createCore("Engine", ContextComponent.class)).thenReturn(componentCore);
-
- ContextRoot contextRoot = factory.createContextRoot("Car", ContextType.UNITUNDERTEST);
- ContextComponent contextComponent = factory.createContextComponent("Engine", contextRoot);
-
- assertThat(contextComponent.getContextRoot()).isEqualTo(contextRoot);
- }
-
- private Core createCore(String type) {
- Core core = mock(Core.class);
-
- Map<String, Value> values = new HashMap<>();
- values.put("Name", ValueType.STRING.create("Name"));
- values.put("Version", ValueType.STRING.create("Version"));
-
- when(core.getValues()).thenReturn(values);
- when(core.getTypeName()).thenReturn(type);
- when(core.getPermanentStore()).thenReturn(new EntityStore());
- when(core.getChildrenStore()).thenReturn(new ChildrenStore());
-
- return core;
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.adapter.ChildrenStore;
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.adapter.EntityStore;
+
+public class ContextComponentTest {
+
+ @org.junit.Test
+ public void testGetContextRoot() {
+ BaseEntityFactory factory = spy(BaseEntityFactory.class);
+ Core rootCore = createCore("UNITUNDERTEST");
+ when(factory.createCore(ContextRoot.class, ContextType.UNITUNDERTEST)).thenReturn(rootCore);
+ Core componentCore = createCore("");
+ when(factory.createCore("Engine", ContextComponent.class)).thenReturn(componentCore);
+
+ ContextRoot contextRoot = factory.createContextRoot("Car", ContextType.UNITUNDERTEST);
+ ContextComponent contextComponent = factory.createContextComponent("Engine", contextRoot);
+
+ assertThat(contextComponent.getContextRoot()).isEqualTo(contextRoot);
+ }
+
+ private Core createCore(String type) {
+ Core core = mock(Core.class);
+
+ Map<String, Value> values = new HashMap<>();
+ values.put("Name", ValueType.STRING.create("Name"));
+ values.put("Version", ValueType.STRING.create("Version"));
+
+ when(core.getValues()).thenReturn(values);
+ when(core.getTypeName()).thenReturn(type);
+ when(core.getPermanentStore()).thenReturn(new EntityStore());
+ when(core.getChildrenStore()).thenReturn(new ChildrenStore());
+
+ return core;
+ }
+}
diff --git a/src/test/java/org/eclipse/mdm/api/base/model/ContextSensorTest.java b/src/test/java/org/eclipse/mdm/api/base/model/ContextSensorTest.java
index 1dbf159..d327e50 100644
--- a/src/test/java/org/eclipse/mdm/api/base/model/ContextSensorTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/model/ContextSensorTest.java
@@ -1,63 +1,62 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-package org.eclipse.mdm.api.base.model;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.mdm.api.base.adapter.ChildrenStore;
-import org.eclipse.mdm.api.base.adapter.Core;
-import org.eclipse.mdm.api.base.adapter.EntityStore;
-
-
-public class ContextSensorTest {
-
- @org.junit.Test
- public void testGetContextComponent() {
- BaseEntityFactory factory = spy(BaseEntityFactory.class);
- Core rootCore = createCore("TESTEQUIPMENT");
- when(factory.createCore(ContextRoot.class, ContextType.TESTEQUIPMENT)).thenReturn(rootCore);
- Core componentCore = createCore("");
- when(factory.createCore("SensorDevice", ContextComponent.class)).thenReturn(componentCore);
- Core sensorCore = createCore("");
- when(factory.createCore("Sensor", ContextSensor.class)).thenReturn(sensorCore);
-
- ContextRoot contextRoot = factory.createContextRoot("SensorDevices", ContextType.TESTEQUIPMENT);
- ContextComponent contextComponent = factory.createContextComponent("SensorDevice", contextRoot);
- ContextSensor contextSensor = factory.createContextSensor("Sensor", contextComponent);
-
- assertThat(contextSensor.getContextComponent()).isEqualTo(contextComponent);
- }
-
- private Core createCore(String type) {
- Core core = mock(Core.class);
-
- Map<String, Value> values = new HashMap<>();
- values.put("Name", ValueType.STRING.create("Name"));
- values.put("Version", ValueType.STRING.create("Version"));
-
- when(core.getValues()).thenReturn(values);
- when(core.getTypeName()).thenReturn(type);
- when(core.getPermanentStore()).thenReturn(new EntityStore());
- when(core.getChildrenStore()).thenReturn(new ChildrenStore());
-
- return core;
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.mdm.api.base.adapter.ChildrenStore;
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.adapter.EntityStore;
+
+public class ContextSensorTest {
+
+ @org.junit.Test
+ public void testGetContextComponent() {
+ BaseEntityFactory factory = spy(BaseEntityFactory.class);
+ Core rootCore = createCore("TESTEQUIPMENT");
+ when(factory.createCore(ContextRoot.class, ContextType.TESTEQUIPMENT)).thenReturn(rootCore);
+ Core componentCore = createCore("");
+ when(factory.createCore("SensorDevice", ContextComponent.class)).thenReturn(componentCore);
+ Core sensorCore = createCore("");
+ when(factory.createCore("Sensor", ContextSensor.class)).thenReturn(sensorCore);
+
+ ContextRoot contextRoot = factory.createContextRoot("SensorDevices", ContextType.TESTEQUIPMENT);
+ ContextComponent contextComponent = factory.createContextComponent("SensorDevice", contextRoot);
+ ContextSensor contextSensor = factory.createContextSensor("Sensor", contextComponent);
+
+ assertThat(contextSensor.getContextComponent()).isEqualTo(contextComponent);
+ }
+
+ private Core createCore(String type) {
+ Core core = mock(Core.class);
+
+ Map<String, Value> values = new HashMap<>();
+ values.put("Name", ValueType.STRING.create("Name"));
+ values.put("Version", ValueType.STRING.create("Version"));
+
+ when(core.getValues()).thenReturn(values);
+ when(core.getTypeName()).thenReturn(type);
+ when(core.getPermanentStore()).thenReturn(new EntityStore());
+ when(core.getChildrenStore()).thenReturn(new ChildrenStore());
+
+ return core;
+ }
+}
diff --git a/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java b/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
index a21db22..cd0250f 100755
--- a/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/model/ModelTest.java
@@ -12,7 +12,6 @@
*
********************************************************************************/
-
package org.eclipse.mdm.api.base.model;
import static org.junit.Assert.assertEquals;
@@ -44,10 +43,9 @@
// compare doubles up to this accuracy
private static final double EPSILON = 0.00005d;
-
/**
- * basic test for reading the value of a parameter.The intialization via
- * maps is needed to simulate the data store.
+ * basic test for reading the value of a parameter.The intialization via maps is
+ * needed to simulate the data store.
*/
@org.junit.Test
public void parameterValue() {
@@ -70,7 +68,8 @@
public void measuredValueFloat() {
Float[] vals = { 1.0f, 2.0f, 3.7f, 2.1f };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.FLOAT, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.FLOAT, "Value1", "lightyears",
+ SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<Float> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {
@@ -90,7 +89,8 @@
public void measuredValueDouble() {
Double[] vals = { 1.0d, 2.0d, 3.7d, 2.1d };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.DOUBLE, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.DOUBLE, "Value1", "lightyears",
+ SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<Double> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {
@@ -110,7 +110,8 @@
public void measuredValueString() {
String[] vals = { "str1", "str2", "str3", "str4" };
boolean[] flags = { true, true, false, true };
- MeasuredValues mv = new MeasuredValues(ScalarType.STRING, "Value1", "lightyears", SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
+ MeasuredValues mv = new MeasuredValues(ScalarType.STRING, "Value1", "lightyears",
+ SequenceRepresentation.EXPLICIT, new double[0], false, AxisType.Y_AXIS, vals, flags);
ValueIterator<String> valueIterator = mv.iterator();
int i = 0;
while (valueIterator.hasNext()) {
@@ -124,8 +125,8 @@
}
/**
- * basic test for reading attributes of the channel.The intialization via
- * maps is needed to simulate the data store.
+ * basic test for reading attributes of the channel.The intialization via maps
+ * is needed to simulate the data store.
*/
@org.junit.Test
public void getChannelAttrs() {
@@ -143,8 +144,8 @@
}
/**
- * basic test to read the default scalar type of a quantity. The
- * intialization via maps is needed to simulate the data store.
+ * basic test to read the default scalar type of a quantity. The intialization
+ * via maps is needed to simulate the data store.
*/
@org.junit.Test
public void getQuantity() {
@@ -176,8 +177,8 @@
/**
* basic test for getting a measurement channel and all necessary related
- * objects (measurment, and so on) via factory methods. The intialization
- * via maps is needed to simulate the data store.
+ * objects (measurment, and so on) via factory methods. The intialization via
+ * maps is needed to simulate the data store.
*/
@org.junit.Test
public void entityFactory() {
diff --git a/src/test/java/org/eclipse/mdm/api/base/model/ValueTypeTest.java b/src/test/java/org/eclipse/mdm/api/base/model/ValueTypeTest.java
index 543b090..cd004ed 100644
--- a/src/test/java/org/eclipse/mdm/api/base/model/ValueTypeTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/model/ValueTypeTest.java
@@ -1,16 +1,16 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
package org.eclipse.mdm.api.base.model;
@@ -22,17 +22,17 @@
@Before
public void init() {
- EnumRegistry.getInstance();
+ EnumRegistry.getInstance();
}
@org.junit.Test
public void testExtractStringFromUnknown() {
Value v = ValueType.UNKNOWN.create("Name", "abcd");
-
+
assertThat((String) v.extract()).isEqualTo("abcd");
assertThat(v.extract(ValueType.UNKNOWN)).isEqualTo("abcd");
}
-
+
@org.junit.Test
public void testExtractString() {
Value v = ValueType.STRING.create("Name", "abcd");
@@ -40,7 +40,7 @@
assertThat((String) v.extract()).isEqualTo("abcd");
assertThat(v.extract(ValueType.STRING)).isEqualTo("abcd");
}
-
+
@org.junit.Test
public void testExtractInteger() {
Value v = ValueType.INTEGER.create("Id", 1);
@@ -48,30 +48,32 @@
assertThat((int) v.extract()).isEqualTo(1);
assertThat(v.extract(ValueType.INTEGER)).isEqualTo(1);
}
-
+
@org.junit.Test
public void testExtractIntegerSequence() {
int[] ints = new int[] { 1, 2, 3 };
-
+
Value v = ValueType.INTEGER_SEQUENCE.create("Ids", ints);
assertThat((int[]) v.extract()).isEqualTo(ints);
assertThat(v.extract(ValueType.INTEGER_SEQUENCE)).isEqualTo(ints);
}
-
+
@org.junit.Test
public void testExtractEnumeration() {
- Value v = ValueType.ENUMERATION.create("ScalarTypeField", "", true, ScalarType.INTEGER, EnumRegistry.SCALAR_TYPE);
-
+ Value v = ValueType.ENUMERATION.create("ScalarTypeField", "", true, ScalarType.INTEGER,
+ EnumRegistry.SCALAR_TYPE);
+
assertThat(v.extract(ValueType.ENUMERATION)).isEqualTo(ScalarType.INTEGER);
}
-
+
@org.junit.Test
public void testExtractEnumerationSequence() {
ScalarType[] scalaTypes = new ScalarType[] { ScalarType.FLOAT, ScalarType.INTEGER };
-
- Value v = ValueType.ENUMERATION_SEQUENCE.create("ScalarTypeSeqField", "", true, scalaTypes, EnumRegistry.SCALAR_TYPE);
-
+
+ Value v = ValueType.ENUMERATION_SEQUENCE.create("ScalarTypeSeqField", "", true, scalaTypes,
+ EnumRegistry.SCALAR_TYPE);
+
assertThat(v.extract(ValueType.ENUMERATION_SEQUENCE)).isEqualTo(scalaTypes);
}
}
diff --git a/src/test/java/org/eclipse/mdm/api/base/query/FilterTest.java b/src/test/java/org/eclipse/mdm/api/base/query/FilterTest.java
index a052d2e..3e896ba 100755
--- a/src/test/java/org/eclipse/mdm/api/base/query/FilterTest.java
+++ b/src/test/java/org/eclipse/mdm/api/base/query/FilterTest.java
@@ -1,114 +1,113 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-
-package org.eclipse.mdm.api.base.query;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.mdm.api.base.EntityTypeImpl;
-import org.eclipse.mdm.api.base.RelationImpl;
-import org.eclipse.mdm.api.base.RelationImpl.AttributeType;
-import org.eclipse.mdm.api.base.model.EnumRegistry;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test the Filter class
- *
- * @author Alexander Nehmer
- *
- */
-public class FilterTest {
-
- static String[] values = new String[] { "1", "2", "3" };
-
- @Before
- public void init() {
- EnumRegistry.getInstance();
- }
-
- /**
- * Tests ids(EntityType entityType, Collection<String> ids)
- */
- @Test
- public void testIdsEntityType() {
- Filter filter = Filter.and();
- assertEquals(filter.stream().toArray().length, 0);
-
- filter = Filter.and().ids(new EntityTypeImpl(), Arrays.asList(values));
-
- String[] filterCondition = filter.iterator().next().getCondition().getValue().extract();
-
- Iterator<String> valuesIterator = Arrays.asList(values).iterator();
- Iterator<String> filterConditionIterator = Arrays.stream(filterCondition).iterator();
-
- while (valuesIterator.hasNext() && filterConditionIterator.hasNext()) {
- assertEquals(valuesIterator.next(), filterConditionIterator.next());
- }
- }
-
- /**
- * Tests ids(Relation relation, Collection<String> ids)
- */
- @Test
- public void testIdsRelation() {
- Filter filter = Filter.and();
- assertEquals(filter.stream().toArray().length, 0);
-
- filter = Filter.and().ids(new RelationImpl(AttributeType.ID), Arrays.asList(values));
-
- String[] filterCondition = filter.iterator().next().getCondition().getValue().extract();
-
- Iterator<String> valuesIterator = Arrays.asList(values).iterator();
- Iterator<String> filterConditionIterator = Arrays.stream(filterCondition).iterator();
-
- while (valuesIterator.hasNext() && filterConditionIterator.hasNext()) {
- assertEquals(valuesIterator.next(), filterConditionIterator.next());
- }
- }
-
- /**
- * Tests id(EntityType entityType, String id)
- */
- @Test
- public void testIdEntity() {
- Filter filter = Filter.and();
- assertEquals(filter.stream().toArray().length, 0);
-
- filter = Filter.and().id(new EntityTypeImpl(), "1");
-
- String filterCondition = filter.iterator().next().getCondition().getValue().extract();
-
- assertEquals(filterCondition, "1");
- }
-
- /**
- * Tests id(Relation relation, String id)
- */
- @Test
- public void testIdRelation() {
- Filter filter = Filter.and();
- assertEquals(filter.stream().toArray().length, 0);
-
- filter = Filter.and().id(new RelationImpl(AttributeType.ID), "1");
-
- String filterCondition = filter.iterator().next().getCondition().getValue().extract();
-
- assertEquals(filterCondition, "1");
- }
-}
+/********************************************************************************
+ * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+package org.eclipse.mdm.api.base.query;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.mdm.api.base.EntityTypeImpl;
+import org.eclipse.mdm.api.base.RelationImpl;
+import org.eclipse.mdm.api.base.RelationImpl.AttributeType;
+import org.eclipse.mdm.api.base.model.EnumRegistry;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the Filter class
+ *
+ * @author Alexander Nehmer
+ *
+ */
+public class FilterTest {
+
+ static String[] values = new String[] { "1", "2", "3" };
+
+ @Before
+ public void init() {
+ EnumRegistry.getInstance();
+ }
+
+ /**
+ * Tests ids(EntityType entityType, Collection<String> ids)
+ */
+ @Test
+ public void testIdsEntityType() {
+ Filter filter = Filter.and();
+ assertEquals(filter.stream().toArray().length, 0);
+
+ filter = Filter.and().ids(new EntityTypeImpl(), Arrays.asList(values));
+
+ String[] filterCondition = filter.iterator().next().getCondition().getValue().extract();
+
+ Iterator<String> valuesIterator = Arrays.asList(values).iterator();
+ Iterator<String> filterConditionIterator = Arrays.stream(filterCondition).iterator();
+
+ while (valuesIterator.hasNext() && filterConditionIterator.hasNext()) {
+ assertEquals(valuesIterator.next(), filterConditionIterator.next());
+ }
+ }
+
+ /**
+ * Tests ids(Relation relation, Collection<String> ids)
+ */
+ @Test
+ public void testIdsRelation() {
+ Filter filter = Filter.and();
+ assertEquals(filter.stream().toArray().length, 0);
+
+ filter = Filter.and().ids(new RelationImpl(AttributeType.ID), Arrays.asList(values));
+
+ String[] filterCondition = filter.iterator().next().getCondition().getValue().extract();
+
+ Iterator<String> valuesIterator = Arrays.asList(values).iterator();
+ Iterator<String> filterConditionIterator = Arrays.stream(filterCondition).iterator();
+
+ while (valuesIterator.hasNext() && filterConditionIterator.hasNext()) {
+ assertEquals(valuesIterator.next(), filterConditionIterator.next());
+ }
+ }
+
+ /**
+ * Tests id(EntityType entityType, String id)
+ */
+ @Test
+ public void testIdEntity() {
+ Filter filter = Filter.and();
+ assertEquals(filter.stream().toArray().length, 0);
+
+ filter = Filter.and().id(new EntityTypeImpl(), "1");
+
+ String filterCondition = filter.iterator().next().getCondition().getValue().extract();
+
+ assertEquals(filterCondition, "1");
+ }
+
+ /**
+ * Tests id(Relation relation, String id)
+ */
+ @Test
+ public void testIdRelation() {
+ Filter filter = Filter.and();
+ assertEquals(filter.stream().toArray().length, 0);
+
+ filter = Filter.and().id(new RelationImpl(AttributeType.ID), "1");
+
+ String filterCondition = filter.iterator().next().getCondition().getValue().extract();
+
+ assertEquals(filterCondition, "1");
+ }
+}