Merge branch 'dev'
Change-Id: I4513fa48b2e640017bf0a634e7ece4dbb1c3f71a
diff --git a/build.gradle b/build.gradle
index 4b9bac8..769620d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,7 +14,7 @@
description = 'MDM API - Default Model'
group = 'org.eclipse.mdm'
-version = '5.0.0'
+version = '5.1.0M1-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'maven'
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/EntityManager.java b/src/main/java/org/eclipse/mdm/api/dflt/EntityManager.java
index b36f590..6878e61 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/EntityManager.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/EntityManager.java
@@ -1,15 +1,15 @@
-/********************************************************************************
- * 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.dflt;
@@ -22,7 +22,9 @@
import org.eclipse.mdm.api.base.BaseEntityManager;
import org.eclipse.mdm.api.base.model.ContextType;
import org.eclipse.mdm.api.base.model.Entity;
+import org.eclipse.mdm.api.base.model.StatusAttachable;
import org.eclipse.mdm.api.base.query.DataAccessException;
+import org.eclipse.mdm.api.dflt.model.Status;
import org.eclipse.mdm.api.dflt.model.Versionable;
/**
@@ -163,4 +165,7 @@
return loadAll(entityClass, contextType, name).stream().filter(v -> v.nameEquals(name))
.filter(Versionable::isValid).max(Versionable.COMPARATOR);
}
+
+
+ <T extends StatusAttachable> List<T> loadAll(Class<T> entityClass, Status status, String pattern);
}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/Classification.java b/src/main/java/org/eclipse/mdm/api/dflt/model/Classification.java
new file mode 100644
index 0000000..5bacc86
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/Classification.java
@@ -0,0 +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.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.StatusAttachable;
+
+import java.util.List;
+
+public class Classification
+ extends BaseEntity {
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core
+ * The {@link Core}.
+ */
+ Classification(Core core) {
+ super(core);
+ }
+
+ /**
+ * Assigns this status to given {@link StatusAttachable}s.
+ *
+ * @param <T>
+ * The status attachable type.
+ * @param statusAttachables
+ * This status will be assigned to all of them.
+ */
+ public <T extends StatusAttachable> void assign(List<T> statusAttachables) {
+ statusAttachables.forEach(this::assign);
+ }
+
+ /**
+ * Assigns this status to given {@link StatusAttachable}.
+ *
+ * @param <T>
+ * The status attachable type.
+ * @param statusAttachable
+ * This status will be assigned to it.
+ */
+ public <T extends StatusAttachable> void assign(T statusAttachable) {
+ getCore(statusAttachable).getMutableStore().set(this);
+ }
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/Domain.java b/src/main/java/org/eclipse/mdm/api/dflt/model/Domain.java
new file mode 100644
index 0000000..5c6833f
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/Domain.java
@@ -0,0 +1,35 @@
+/********************************************************************************
+ * 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.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.Describable;
+
+public class Domain extends BaseEntity implements Describable {
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core
+ * The {@link Core}.
+ */
+ Domain(Core core) {
+ super(core);
+ }
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
index 7d2a7ed..0137401 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
@@ -1,15 +1,15 @@
-/********************************************************************************
- * 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.dflt.model;
@@ -814,6 +814,34 @@
return valueListValue;
}
+ public Classification createClassification(String name, Status status, ProjectDomain projectDomain, Domain domain) {
+ Classification classification = new Classification(createCore(Classification.class));
+
+ getMutableStore(classification).set(status);
+ getMutableStore(classification).set(projectDomain);
+ getMutableStore(classification).set(domain);
+
+ // properties
+ classification.setName(name);
+
+ return classification;
+ }
+
+ public ProjectDomain createProjectDomain(String name) {
+ ProjectDomain projectDomain = new ProjectDomain(createCore(ProjectDomain.class));
+ // properties
+ projectDomain.setName(name);
+ return projectDomain;
+ }
+
+ public Domain createDomain(String name) {
+ Domain domain = new Domain(createCore(Domain.class));
+
+ // properties
+ domain.setName(name);
+ return domain;
+ }
+
// ======================================================================
// Protected methods
// ======================================================================
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/ProjectDomain.java b/src/main/java/org/eclipse/mdm/api/dflt/model/ProjectDomain.java
new file mode 100644
index 0000000..0f8f6cb
--- /dev/null
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/ProjectDomain.java
@@ -0,0 +1,35 @@
+/********************************************************************************
+ * 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.dflt.model;
+
+import org.eclipse.mdm.api.base.adapter.Core;
+import org.eclipse.mdm.api.base.model.BaseEntity;
+import org.eclipse.mdm.api.base.model.Describable;
+
+public class ProjectDomain extends BaseEntity implements Describable {
+
+ // ======================================================================
+ // Constructors
+ // ======================================================================
+
+ /**
+ * Constructor.
+ *
+ * @param core The {@link Core}.
+ */
+ ProjectDomain(Core core) {
+ super(core);
+ }
+}
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/Status.java b/src/main/java/org/eclipse/mdm/api/dflt/model/Status.java
index d0264a0..2e28414 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/model/Status.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/Status.java
@@ -1,15 +1,15 @@
-/********************************************************************************
- * 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.dflt.model;
@@ -84,7 +84,11 @@
* @return Optional is empty if no {@code Status} is attached.
*/
public static Optional<Status> of(StatusAttachable statusAttachable) {
- return Optional.ofNullable(getCore(statusAttachable).getMutableStore().get(Status.class));
+ Classification classification = getCore(statusAttachable).getMutableStore().get(Classification.class);
+ if ( classification == null ) {
+ return Optional.empty();
+ }
+ return Optional.ofNullable(getCore(classification).getMutableStore().get(Status.class));
}
}