Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Krueger2015-06-24 10:43:55 -0400
committerJan Krueger2015-06-24 10:43:55 -0400
commit7bf7f1ed67d2d0304df80f848dc02cf0b4e8a08b (patch)
tree360939b0f8746b08c9615bd18e8f5820b1a9cfa9
parentd9409b7bd0705cf133d603e5d10421bf0d68d9de (diff)
downloadorg.eclipse.openk-platform.openk-repo-7bf7f1ed67d2d0304df80f848dc02cf0b4e8a08b.tar.gz
org.eclipse.openk-platform.openk-repo-7bf7f1ed67d2d0304df80f848dc02cf0b4e8a08b.tar.xz
org.eclipse.openk-platform.openk-repo-7bf7f1ed67d2d0304df80f848dc02cf0b4e8a08b.zip
Merger and Eismann-Rest-Controller adapted for CacheDB
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/adapter/rest/controller/SubGeographicalRegionRestController.java8
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/core/SubGeographicalRegion.java4
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/ActivePower.java2
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/Voltage.java2
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/meas/AnalogValue.java2
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalSerializer.java35
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BooleanDeserializer.java29
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/SubstationListSerializer.java33
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/Abstract4Tree.java9
-rw-r--r--openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/mapper/BigDecimalDeserializer.java (renamed from openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalDeserializer.java)2
-rw-r--r--openk-platform/openk-cachedb-service/src/main/webapp/WEB-INF/database-spring-data.xml2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubGeographicalRegionRestConsumer.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubGeographicalRegionRestConsumer.java)11
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubstationRestConsumer.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubstationRestConsumer.java)15
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SynchronousMachineRestConsumer.java38
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java)6
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/PreselectionRestController.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/PreselectionRestController.java)2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReasonOfReductionRestController.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReasonOfReductionRestController.java)2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReductionSettingsRestController.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReductionSettingsRestController.java)2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubGeographicalRegionRestController.java203
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubstationRestController.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubstationRestController.java)11
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/IncludeAttribute4Json.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/config/IncludeAttribute4Json.java)2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/JpaUtils.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java)2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/BaseRestController.java58
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java192
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Abstract4Tree.java71
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/SubGeographicalRegion4Tree.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/NominationDocument.java)25
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Substation4Tree.java (renamed from openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Greeting.java)17
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/EquipmentContainer.java2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/SubGeographicalRegion.java2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/process/Activity.java2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SwitchOffAdviceService.java10
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/webapp/WEB-INF/restful-servlet.xml2
32 files changed, 376 insertions, 427 deletions
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/adapter/rest/controller/SubGeographicalRegionRestController.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/adapter/rest/controller/SubGeographicalRegionRestController.java
index 65508737..77084f01 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/adapter/rest/controller/SubGeographicalRegionRestController.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/adapter/rest/controller/SubGeographicalRegionRestController.java
@@ -61,7 +61,7 @@ public class SubGeographicalRegionRestController {
* @return
*/
@RequestMapping(value = "/subgeographicalregion/tree", method = RequestMethod.GET)
- public List<SubGeographicalRegion4Tree> findAllSubGeographicalRegion4Tree() {
+ public List<SubGeographicalRegion4Tree> getSubGeographicalRegion4Tree() {
final List<SubGeographicalRegion4Tree> subGeographicalRegion4TreeList = new ArrayList<>();
// todo: nur die, die Einspeiser haben
@@ -69,16 +69,22 @@ public class SubGeographicalRegionRestController {
final SubGeographicalRegion4Tree subGeographicalRegion4Tree = new SubGeographicalRegion4Tree();
subGeographicalRegion4Tree.setName(subGeographicalRegionJpa.getName());
+ subGeographicalRegion4Tree.setOid(subGeographicalRegionJpa.getOid().toString());
// todo: Aufsummierungen!
subGeographicalRegion4Tree.setBio("5220");
+ subGeographicalRegion4Tree.setPv("56999");
+ subGeographicalRegion4Tree.setWind("233696");
final List<Substation4Tree> substation4TreeList = new ArrayList<>();
for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
//substation4TreeList = new ArrayList<>();
final Substation4Tree substation4Tree = new Substation4Tree();
+ substation4Tree.setOid(substationJpa.getOid().toString());
substation4Tree.setName(substationJpa.getName());
substation4Tree.setBio("55889");
+ substation4Tree.setPv("2366");
+ substation4Tree.setWind("22569");
substation4TreeList.add(substation4Tree);
}
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/core/SubGeographicalRegion.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/core/SubGeographicalRegion.java
index 613a0d09..7b68e18e 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/core/SubGeographicalRegion.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/core/SubGeographicalRegion.java
@@ -13,9 +13,7 @@
package org.eclipse.openk.cachedb.model.cim.core;
import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.eclipse.openk.cachedb.adapter.rest.controller.util.IncludeAttribute4Json;
-import org.eclipse.openk.cachedb.model.mapper.util.SubstationListSerializer;
import java.util.List;
@@ -28,8 +26,6 @@ public class SubGeographicalRegion extends IdentifiedObject {
@JsonView({IncludeAttribute4Json.Topology.class,
IncludeAttribute4Json.NetworkState.class})
- //@JsonProperty(value = "children")
- @JsonSerialize(using = SubstationListSerializer.class)
private List<Substation> substationList;
public List<Substation> getSubstationList() {
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/ActivePower.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/ActivePower.java
index b979a5ec..c714c1a7 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/ActivePower.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/ActivePower.java
@@ -15,7 +15,7 @@ package org.eclipse.openk.cachedb.model.cim.domain;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.eclipse.openk.cachedb.adapter.rest.controller.util.IncludeAttribute4Json;
-import org.eclipse.openk.cachedb.model.mapper.util.BigDecimalDeserializer;
+import org.eclipse.openk.cachedb.model.util.mapper.BigDecimalDeserializer;
/**
* Product of RMS value of the voltage and the RMS value of the in-phase component
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/Voltage.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/Voltage.java
index 42648c55..46068dae 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/Voltage.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/domain/Voltage.java
@@ -15,7 +15,7 @@ package org.eclipse.openk.cachedb.model.cim.domain;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.eclipse.openk.cachedb.adapter.rest.controller.util.IncludeAttribute4Json;
-import org.eclipse.openk.cachedb.model.mapper.util.BigDecimalDeserializer;
+import org.eclipse.openk.cachedb.model.util.mapper.BigDecimalDeserializer;
/**
* Electrical voltage.
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/meas/AnalogValue.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/meas/AnalogValue.java
index c922599d..7444ec16 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/meas/AnalogValue.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/cim/meas/AnalogValue.java
@@ -15,7 +15,7 @@ package org.eclipse.openk.cachedb.model.cim.meas;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.eclipse.openk.cachedb.adapter.rest.controller.util.IncludeAttribute4Json;
-import org.eclipse.openk.cachedb.model.mapper.util.BigDecimalDeserializer;
+import org.eclipse.openk.cachedb.model.util.mapper.BigDecimalDeserializer;
/**
* AnalogValue represents an analog MeasurementValue.
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalSerializer.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalSerializer.java
deleted file mode 100644
index 1b224e50..00000000
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalSerializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * ****************************************************************************
- * Copyright (c) 2015 BTC AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * <p/>
- * Contributors:
- * Jan Krueger - initial API and implementation
- * *****************************************************************************
- */
-package org.eclipse.openk.cachedb.model.mapper.util;
-
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-
-// todo: diese Klasse in ein uitl-maven-modul verschieben
-// todo: => nein der Serialiser/Desirailaiser wird nur in cachedb verwendet
-public class BigDecimalSerializer extends JsonSerializer<BigDecimal> {
-
- @Override
- public void serialize(final BigDecimal bigDecimal, final JsonGenerator jsonGenerator,
- final SerializerProvider serializerProvider)
- throws IOException, JsonProcessingException {
- final String stest = "";
- jsonGenerator.setCurrentValue(stest);
- }
-}
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BooleanDeserializer.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BooleanDeserializer.java
deleted file mode 100644
index 72954a90..00000000
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BooleanDeserializer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * ****************************************************************************
- * Copyright (c) 2015 BTC AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * <p/>
- * Contributors:
- * Jan Krueger - initial API and implementation
- * *****************************************************************************
- */
-package org.eclipse.openk.cachedb.model.mapper.util;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-
-import java.io.IOException;
-
-public class BooleanDeserializer extends JsonDeserializer<Boolean> {
-
- @Override
- public Boolean deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext)
- throws IOException, JsonProcessingException {
- return Boolean.parseBoolean(jsonParser.getText());
- }
-}
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/SubstationListSerializer.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/SubstationListSerializer.java
deleted file mode 100644
index fdc87764..00000000
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/SubstationListSerializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * ****************************************************************************
- * Copyright (c) 2015 BTC AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * <p/>
- * Contributors:
- * Jan Krueger - initial API and implementation
- * *****************************************************************************
- */
-package org.eclipse.openk.cachedb.model.mapper.util;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import org.eclipse.openk.cachedb.model.cim.core.Substation;
-
-import java.io.IOException;
-import java.util.List;
-
-public class SubstationListSerializer extends JsonSerializer<List<Substation>> {
-
- @Override
- public void serialize(final List<Substation> substations, final JsonGenerator jsonGenerator,
- final SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
- final String stest = "";
- jsonGenerator.setCurrentValue(stest);
-
- }
-}
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/Abstract4Tree.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/Abstract4Tree.java
index da7bf31c..2889e58f 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/Abstract4Tree.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/Abstract4Tree.java
@@ -14,12 +14,21 @@ package org.eclipse.openk.cachedb.model.util;
public class Abstract4Tree {
+ private String oid;
private String name;
private String pv;
private String bio;
private String wind;
private String sum;
+ public String getOid() {
+ return oid;
+ }
+
+ public void setOid(final String oid) {
+ this.oid = oid;
+ }
+
public String getName() {
return name;
}
diff --git a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalDeserializer.java b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/mapper/BigDecimalDeserializer.java
index 91bc33cb..3b405c4e 100644
--- a/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/mapper/util/BigDecimalDeserializer.java
+++ b/openk-platform/openk-cachedb-service/src/main/java/org/eclipse/openk/cachedb/model/util/mapper/BigDecimalDeserializer.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.cachedb.model.mapper.util;
+package org.eclipse.openk.cachedb.model.util.mapper;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/openk-platform/openk-cachedb-service/src/main/webapp/WEB-INF/database-spring-data.xml b/openk-platform/openk-cachedb-service/src/main/webapp/WEB-INF/database-spring-data.xml
index 41be8294..40c179f3 100644
--- a/openk-platform/openk-cachedb-service/src/main/webapp/WEB-INF/database-spring-data.xml
+++ b/openk-platform/openk-cachedb-service/src/main/webapp/WEB-INF/database-spring-data.xml
@@ -39,7 +39,7 @@
<bean id="cacheDbEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<!-- todo: nur package org.eclipse.openk.cachedb.model.jpa -->
- <property name="packagesToScan" value="org.eclipse.openk.model, org.eclipse.openk.cachedb.model.jpa"/>
+ <property name="packagesToScan" value="org.eclipse.openk.cachedb.model.jpa"/>
<property name="dataSource" ref="cacheDbDataSource"/>
<property name="jpaPropertyMap">
<map>
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubGeographicalRegionRestConsumer.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubGeographicalRegionRestConsumer.java
index 6caa58b4..5ed3f784 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubGeographicalRegionRestConsumer.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubGeographicalRegionRestConsumer.java
@@ -10,9 +10,10 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.adapter.rest;
+package org.eclipse.openk.eisman.adapter.rest.consumer;
import com.liferay.portal.kernel.util.PropsUtil;
+import org.eclipse.openk.eisman.model.SubGeographicalRegion4Tree;
import org.eclipse.openk.eisman.model.core.SubGeographicalRegion;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@@ -36,9 +37,9 @@ public class SubGeographicalRegionRestConsumer {
return Arrays.asList(restTemplate.getForObject(uri, SubGeographicalRegion[].class));
}
-// public List<Substation> getSubstationListOfSubGeographicalRegionList() {
-// final String uri = PropsUtil.get("esb.url.base") + PropsUtil.get("esb.rest.uri.subgeographicalregion.substationlist");
-// return Arrays.asList(restTemplate.getForObject(uri, Substation[].class));
-// }
+ public List<SubGeographicalRegion4Tree> getSubGeographicalRegion4Tree() {
+ final String uri = PropsUtil.get("esb.url.base") + PropsUtil.get("esb.rest.uri.subgeographicalregion.tree");
+ return Arrays.asList(restTemplate.getForObject(uri, SubGeographicalRegion4Tree[].class));
+ }
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubstationRestConsumer.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubstationRestConsumer.java
index 548bb04c..de862ad5 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/SubstationRestConsumer.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SubstationRestConsumer.java
@@ -10,11 +10,10 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.adapter.rest;
+package org.eclipse.openk.eisman.adapter.rest.consumer;
import com.liferay.portal.kernel.util.PropsUtil;
import org.eclipse.openk.eisman.model.core.Substation;
-import org.eclipse.openk.eisman.model.wires.SynchronousMachine;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@@ -37,16 +36,4 @@ public class SubstationRestConsumer {
return Arrays.asList(restTemplate.getForObject(uri, Substation[].class));
}
- // todo: ist diese Methode hier korrekt?
- public List<SynchronousMachine> getSynchronousMachineListOfSubstation(final String oid) {
-
- final String uri = PropsUtil.get("esb.url.base")
- + PropsUtil.get("esb.rest.uri.substation.oid")
- + "/" + oid
- + PropsUtil.get("esb.rest.synchronousmachinelist");
-
- return Arrays.asList(restTemplate.getForObject(uri, SynchronousMachine[].class));
- }
-
-
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SynchronousMachineRestConsumer.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SynchronousMachineRestConsumer.java
new file mode 100644
index 00000000..2e457981
--- /dev/null
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/consumer/SynchronousMachineRestConsumer.java
@@ -0,0 +1,38 @@
+/**
+ * ****************************************************************************
+ * Copyright (c) 2015 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * <p/>
+ * Contributors:
+ * Jan Krueger - initial API and implementation
+ * *****************************************************************************
+ */
+package org.eclipse.openk.eisman.adapter.rest.consumer;
+
+import com.liferay.portal.kernel.util.PropsUtil;
+import org.eclipse.openk.eisman.model.wires.SynchronousMachine;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Arrays;
+import java.util.List;
+
+@Service
+public class SynchronousMachineRestConsumer {
+
+ final RestTemplate restTemplate = new RestTemplate();
+
+ public List<SynchronousMachine> getSynchronousMachineListOfSubstation(final String oid) {
+
+ final String uri = PropsUtil.get("esb.url.base")
+ + PropsUtil.get("esb.rest.uri.substation.oid")
+ + "/" + oid
+ + PropsUtil.get("esb.rest.synchronousmachinelist");
+
+ return Arrays.asList(restTemplate.getForObject(uri, SynchronousMachine[].class));
+ }
+
+}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java
index 264cc129..a7dc9e01 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java
@@ -10,13 +10,13 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest;
+package org.eclipse.openk.eisman.adapter.rest.controller;
import com.fasterxml.jackson.annotation.JsonView;
import com.google.common.collect.Lists;
import org.apache.log4j.Logger;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
-import org.eclipse.openk.eisman.controller.util.JpaUtils;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.JpaUtils;
import org.eclipse.openk.eisman.model.process.Activity;
import org.eclipse.openk.eisman.repository.ActivityRepository;
import org.eclipse.openk.eisman.service.SwitchOffAdviceService;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/PreselectionRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/PreselectionRestController.java
index 37357dbd..c095fa2f 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/PreselectionRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/PreselectionRestController.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest;
+package org.eclipse.openk.eisman.adapter.rest.controller;
import org.apache.log4j.Logger;
import org.eclipse.openk.eisman.model.process.Preselection;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReasonOfReductionRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReasonOfReductionRestController.java
index c93fdb82..5bf9d52a 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReasonOfReductionRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReasonOfReductionRestController.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest;
+package org.eclipse.openk.eisman.adapter.rest.controller;
import org.apache.log4j.Logger;
import org.eclipse.openk.eisman.service.ReasonOfReductionService;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReductionSettingsRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReductionSettingsRestController.java
index 050e5cb8..579d6ac5 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ReductionSettingsRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ReductionSettingsRestController.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest;
+package org.eclipse.openk.eisman.adapter.rest.controller;
import org.apache.log4j.Logger;
import org.eclipse.openk.eisman.service.ReductionSettingsService;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubGeographicalRegionRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubGeographicalRegionRestController.java
new file mode 100644
index 00000000..4661e2f4
--- /dev/null
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubGeographicalRegionRestController.java
@@ -0,0 +1,203 @@
+/**
+ * ****************************************************************************
+ * Copyright (c) 2015 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * <p/>
+ * Contributors:
+ * Jan Krueger - initial API and implementation
+ * *****************************************************************************
+ */
+package org.eclipse.openk.eisman.adapter.rest.controller;
+
+import com.fasterxml.jackson.annotation.JsonView;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SubGeographicalRegionRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.model.SubGeographicalRegion4Tree;
+import org.eclipse.openk.eisman.model.core.SubGeographicalRegion;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+public class SubGeographicalRegionRestController {
+
+ @Autowired
+ private SubGeographicalRegionRestConsumer subGeographicalRegionRestConsumer;
+
+ /**
+ * List of all SubGeographicalRegion.
+ * Netzgebiete
+ *
+ * @return
+ */
+ @JsonView(IncludeAttribute4Json.SubGeographicalRegion.class)
+ @RequestMapping(value = "/subgeographicalregion/lov", method = RequestMethod.GET)
+ public List<SubGeographicalRegion> findAllSubGeographicalRegion4Lov() {
+ return subGeographicalRegionRestConsumer.getSubGeographicalRegion();
+ }
+
+ /**
+ * List of all SubGeographicalRegion and their Substations.
+ *
+ * @return
+ */
+ @RequestMapping(value = "/subgeographicalregion/tree", method = RequestMethod.GET)
+ public List<SubGeographicalRegion4Tree> getSubGeographicalRegion4Tree() {
+ return subGeographicalRegionRestConsumer.getSubGeographicalRegion4Tree();
+ }
+
+
+// @JsonView(IncludeAttribute4Json.SubGeographicalRegion.class)
+// public List<TreeObject> getRegionTree() {
+//
+// List<TreeObject> tree = new ArrayList<TreeObject>();
+// try {
+// for (final SubGeographicalRegion region : subGeographicalRegionRestConsumer.getSubGeographicalRegion()) {
+// final TreeObject treeChild = new TreeObject(region.getId(), region.getName());
+//
+// //treeChild.setChildren(getSubStationsForRegion(region.getId()));
+//
+//
+//
+// treeChild.setBio(200);
+// treeChild.setPv(202);
+// treeChild.setWind(200);
+//
+// tree.add(treeChild);
+// }
+// } catch (Exception e) {
+// tree = new ArrayList<TreeObject>();
+// }
+//
+//
+// return tree;
+// }
+
+
+// @RequestMapping(value = "/subgeographicalregion/tree", method = RequestMethod.GET)
+// public List<TreeObject> getSubStationsForRegion() {
+//
+// List<TreeObject> tree = new ArrayList<TreeObject>();
+// final List<SubGeographicalRegion> regions = subGeographicalRegionRestConsumer.getSubGeographicalRegion();
+// try {
+// //TODO Childs richtig auslesen!, Werte setzen
+// for (final SubGeographicalRegion region : regions) {
+//
+//
+// //if (regionId == null) {
+// final TreeObject treeChild = new TreeObject(region.getId(), region.getName());
+//
+// treeChild.setBio(200);
+// treeChild.setPv(202);
+// treeChild.setWind(200);
+// treeChild.setChildren(getRegionTree());
+// tree.add(treeChild);
+//
+//
+// //}
+//
+// }
+// } catch (Exception e) {
+// //e.getMessage();
+// tree = new ArrayList<TreeObject>();
+// }
+//
+//
+// return tree;
+// }
+
+// private class TreeObject {
+//
+// private Long id;
+// private String name;
+// private int pv;
+// private int bio;
+// private int wind;
+// private int sum;
+// private List<TreeObject> children;
+//
+// /**
+// *
+// */
+// public TreeObject() {
+// this.id = 0L;
+// this.name = "";
+// this.pv = 0;
+// this.wind = 0;
+// this.bio = 0;
+// this.children = new ArrayList<TreeObject>();
+// }
+// /**
+// *
+// * @param id
+// * @param name
+// */
+// public TreeObject(final Long id, final String name) {
+// this.id = id;
+// this.name = name;
+// this.pv = 0;
+// this.wind = 0;
+// this.bio = 0;
+// this.children = new ArrayList<TreeObject>();
+// }
+//
+// public Long getId() {
+// return id;
+// }
+//
+// public void setId(final Long id) {
+// this.id = id;
+// }
+//
+// public String getName() {
+// return name;
+// }
+//
+// public void setName(final String name) {
+// this.name = name;
+// }
+//
+// public List<TreeObject> getChildren() {
+// return children;
+// }
+//
+// public void setChildren(final List<TreeObject> children) {
+// this.children = children;
+// }
+//
+// public int getPv() {
+// return pv;
+// }
+//
+// public void setPv(final int pv) {
+// this.pv = pv;
+// }
+//
+// public int getBio() {
+// return bio;
+// }
+//
+// public void setBio(final int bio) {
+// this.bio = bio;
+// }
+//
+// public int getWind() {
+// return wind;
+// }
+//
+// public void setWind(final int wind) {
+// this.wind = wind;
+// }
+//
+// public int getSum() {
+// return wind + bio + pv;
+// }
+// }
+
+}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubstationRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubstationRestController.java
index 66a2a1ff..b635661f 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubstationRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/SubstationRestController.java
@@ -10,11 +10,12 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest;
+package org.eclipse.openk.eisman.adapter.rest.controller;
import com.fasterxml.jackson.annotation.JsonView;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
-import org.eclipse.openk.eisman.adapter.rest.SubstationRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SynchronousMachineRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SubstationRestConsumer;
import org.eclipse.openk.eisman.model.core.Substation;
import org.eclipse.openk.eisman.model.wires.SynchronousMachine;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +32,8 @@ public class SubstationRestController {
@Autowired
private SubstationRestConsumer substationRestConsumer;
+ private SynchronousMachineRestConsumer synchronousMachineRestConsumer;
+
/**
* List of Substations, which hold a SynchronousMachine.
* Includes also Substations, which hold a VoltageLevel, which holds a SynchronousMachine
@@ -46,7 +49,7 @@ public class SubstationRestController {
@RequestMapping(value = "/substation/{oid}/synchronousmachinelist", method = RequestMethod.GET)
public List<SynchronousMachine> getSynchronousMachineListOfSubstation(@PathVariable(value = "oid") final String oid) {
- return substationRestConsumer.getSynchronousMachineListOfSubstation(oid);
+ return synchronousMachineRestConsumer.getSynchronousMachineListOfSubstation(oid);
}
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/config/IncludeAttribute4Json.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/IncludeAttribute4Json.java
index bfb5f55d..56364600 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/config/IncludeAttribute4Json.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/IncludeAttribute4Json.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.rest.config;
+package org.eclipse.openk.eisman.adapter.rest.controller.util;
/*
see https://spring.io/blog/2014/12/02/latest-jackson-integration-improvements-in-spring
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/JpaUtils.java
index 2254a07a..b92f7e68 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/util/JpaUtils.java
@@ -10,7 +10,7 @@
* Jan Krueger - initial API and implementation
* *****************************************************************************
*/
-package org.eclipse.openk.eisman.controller.util;
+package org.eclipse.openk.eisman.adapter.rest.controller.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.jpa.domain.Specification;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/BaseRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/BaseRestController.java
deleted file mode 100644
index 783d7523..00000000
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/BaseRestController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * ****************************************************************************
- * Copyright (c) 2015 BTC AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * <p/>
- * Contributors:
- * Jan Krueger - initial API and implementation
- * *****************************************************************************
- */
-package org.eclipse.openk.eisman.controller.rest;
-
-import org.apache.log4j.Logger;
-import org.eclipse.openk.eisman.model.Greeting;
-import org.eclipse.openk.eisman.model.NominationDocument;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RestController
-public class BaseRestController {
-
- private static final Logger LOG = Logger.getLogger(BaseRestController.class);
-
- @RequestMapping(value = "/nomination/document/{id}", method = RequestMethod.GET)
- public NominationDocument getDocument(@PathVariable final Long id) {
- LOG.info("calling REST of oarchiv-portlet - getDocument with id: " + id);
- return new NominationDocument(10L, "Test JK", 236);
- }
-
- @RequestMapping(value = "/nomination/document", method = RequestMethod.GET)
- public List<NominationDocument> getDocumentList() {
- LOG.info("calling REST of oarchiv-portlet - getDocumentList");// + request.getAuthType());
- final NominationDocument nd1 = new NominationDocument(1L, "Test 01", 111);
- final NominationDocument nd2 = new NominationDocument(2L, "Test 02", 222);
- final List<NominationDocument> nominationDocumentList = new ArrayList<NominationDocument>();
- nominationDocumentList.add(nd1);
- nominationDocumentList.add(nd2);
- return nominationDocumentList;
- }
-
- @RequestMapping(value = "/greeting", method = RequestMethod.GET)
- @ResponseStatus(HttpStatus.OK)
- public Greeting getGreeting() {
- LOG.info("calling REST of oarchiv-portlet - getGreeting");// + request.getAuthType());
- //final Greeting greeting = new Greeting("999", "Hello 999");
- return new Greeting("999", "Hello 999");
- }
-
-}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java
deleted file mode 100644
index 290ee0a9..00000000
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * ****************************************************************************
- * Copyright (c) 2015 BTC AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * <p/>
- * Contributors:
- * Jan Krueger - initial API and implementation
- * *****************************************************************************
- */
-package org.eclipse.openk.eisman.controller.rest;
-
-import com.fasterxml.jackson.annotation.JsonView;
-import org.eclipse.openk.eisman.adapter.rest.SubGeographicalRegionRestConsumer;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
-import org.eclipse.openk.eisman.model.core.SubGeographicalRegion;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RestController
-public class SubGeographicalRegionRestController {
-
- @Autowired
- private SubGeographicalRegionRestConsumer subGeographicalRegionRestConsumer;
-
- /**
- * List of all SubGeographicalRegion.
- * Netzgebiete
- *
- * @return
- */
- @JsonView(IncludeAttribute4Json.SubGeographicalRegion.class)
- @RequestMapping(value = "/subgeographicalregion/lov", method = RequestMethod.GET)
- public List<SubGeographicalRegion> findAllSubGeographicalRegion4Lov() {
- return subGeographicalRegionRestConsumer.getSubGeographicalRegion();
- }
-
- @JsonView(IncludeAttribute4Json.SubGeographicalRegion.class)
- public List<TreeObject> getRegionTree() {
-
- List<TreeObject> tree = new ArrayList<TreeObject>();
- try {
- for (final SubGeographicalRegion region : subGeographicalRegionRestConsumer.getSubGeographicalRegion()) {
- final TreeObject treeChild = new TreeObject(region.getId(), region.getName());
-
- //treeChild.setChildren(getSubStationsForRegion(region.getId()));
-
-
-
- treeChild.setBio(200);
- treeChild.setPv(200);
- treeChild.setWind(200);
-
- tree.add(treeChild);
- }
- } catch (Exception e) {
- tree = new ArrayList<TreeObject>();
- }
-
-
- return tree;
- }
-
-
- @RequestMapping(value = "/subgeographicalregion/tree", method = RequestMethod.GET)
- public List<TreeObject> getSubStationsForRegion() {
-
- List<TreeObject> tree = new ArrayList<TreeObject>();
- final List<SubGeographicalRegion> regions = subGeographicalRegionRestConsumer.getSubGeographicalRegion();
- try {
- //TODO Childs richtig auslesen!, Werte setzen
- for (final SubGeographicalRegion region : regions) {
-
-
- //if (regionId == null) {
- final TreeObject treeChild = new TreeObject(region.getId(), region.getName());
-
- treeChild.setBio(200);
- treeChild.setPv(200);
- treeChild.setWind(200);
- treeChild.setChildren(getRegionTree());
- tree.add(treeChild);
-
-
- //}
-
- }
- } catch (Exception e) {
- //e.getMessage();
- tree = new ArrayList<TreeObject>();
- }
-
-
- return tree;
- }
-
- private class TreeObject {
-
- private Long id;
- private String name;
- private int pv;
- private int bio;
- private int wind;
- private int sum;
- private List<TreeObject> children;
-
- /**
- *
- */
- public TreeObject() {
- this.id = 0L;
- this.name = "";
- this.pv = 0;
- this.wind = 0;
- this.bio = 0;
- this.children = new ArrayList<TreeObject>();
- }
- /**
- *
- * @param id
- * @param name
- */
- public TreeObject(final Long id, final String name) {
- this.id = id;
- this.name = name;
- this.pv = 0;
- this.wind = 0;
- this.bio = 0;
- this.children = new ArrayList<TreeObject>();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(final Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public List<TreeObject> getChildren() {
- return children;
- }
-
- public void setChildren(final List<TreeObject> children) {
- this.children = children;
- }
-
- public int getPv() {
- return pv;
- }
-
- public void setPv(final int pv) {
- this.pv = pv;
- }
-
- public int getBio() {
- return bio;
- }
-
- public void setBio(final int bio) {
- this.bio = bio;
- }
-
- public int getWind() {
- return wind;
- }
-
- public void setWind(final int wind) {
- this.wind = wind;
- }
-
- public int getSum() {
- return wind + bio + pv;
- }
- }
-
-}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Abstract4Tree.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Abstract4Tree.java
new file mode 100644
index 00000000..0ee14da2
--- /dev/null
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Abstract4Tree.java
@@ -0,0 +1,71 @@
+/**
+ * ****************************************************************************
+ * Copyright (c) 2015 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * <p/>
+ * Contributors:
+ * Jan Krueger - initial API and implementation
+ * *****************************************************************************
+ */
+package org.eclipse.openk.eisman.model;
+
+public class Abstract4Tree {
+
+ private String oid;
+ private String name;
+ private String pv;
+ private String bio;
+ private String wind;
+ private String sum;
+
+ public String getOid() {
+ return oid;
+ }
+
+ public void setOid(final String oid) {
+ this.oid = oid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getPv() {
+ return pv;
+ }
+
+ public void setPv(final String pv) {
+ this.pv = pv;
+ }
+
+ public String getBio() {
+ return bio;
+ }
+
+ public void setBio(final String bio) {
+ this.bio = bio;
+ }
+
+ public String getWind() {
+ return wind;
+ }
+
+ public void setWind(final String wind) {
+ this.wind = wind;
+ }
+
+ public String getSum() {
+ return sum;
+ }
+
+ public void setSum(final String sum) {
+ this.sum = sum;
+ }
+}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/NominationDocument.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/SubGeographicalRegion4Tree.java
index 1cd0e364..d5c2c9bd 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/NominationDocument.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/SubGeographicalRegion4Tree.java
@@ -12,27 +12,20 @@
*/
package org.eclipse.openk.eisman.model;
-public class NominationDocument {
+import com.fasterxml.jackson.annotation.JsonProperty;
- private final Long id;
- private final String identification;
- private final int version;
+import java.util.List;
- public NominationDocument(final Long id, final String identification, final int version) {
- this.id = id;
- this.identification = identification;
- this.version = version;
- }
+public class SubGeographicalRegion4Tree extends Abstract4Tree {
- public Long getId() {
- return id;
- }
+ @JsonProperty(value = "children")
+ private List<Substation4Tree> substation4TreeList;
- public String getIdentification() {
- return identification;
+ public List<Substation4Tree> getSubstation4TreeList() {
+ return substation4TreeList;
}
- public int getVersion() {
- return version;
+ public void setSubstation4TreeList(final List<Substation4Tree> substation4TreeList) {
+ this.substation4TreeList = substation4TreeList;
}
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Greeting.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Substation4Tree.java
index ed46423a..728ed93c 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Greeting.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/Substation4Tree.java
@@ -12,21 +12,6 @@
*/
package org.eclipse.openk.eisman.model;
-public class Greeting {
+public class Substation4Tree extends Abstract4Tree {
- private final String id;
- private final String content;
-
- public Greeting(final String id, final String content) {
- this.id = id;
- this.content = content;
- }
-
- public String getId() {
- return id;
- }
-
- public String getContent() {
- return content;
- }
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/EquipmentContainer.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/EquipmentContainer.java
index 79fc5ad7..32c153f7 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/EquipmentContainer.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/EquipmentContainer.java
@@ -13,7 +13,7 @@
package org.eclipse.openk.eisman.model.core;
import com.fasterxml.jackson.annotation.JsonView;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
import org.eclipse.openk.eisman.model.wires.SynchronousMachine;
import javax.persistence.Access;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/SubGeographicalRegion.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/SubGeographicalRegion.java
index 6bb33ae6..22736c7d 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/SubGeographicalRegion.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/core/SubGeographicalRegion.java
@@ -13,7 +13,7 @@
package org.eclipse.openk.eisman.model.core;
import com.fasterxml.jackson.annotation.JsonView;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
import javax.persistence.Access;
import javax.persistence.AccessType;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/process/Activity.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/process/Activity.java
index 757e8422..4b3f2ad7 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/process/Activity.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/process/Activity.java
@@ -14,7 +14,7 @@ package org.eclipse.openk.eisman.model.process;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
-import org.eclipse.openk.eisman.controller.rest.config.IncludeAttribute4Json;
+import org.eclipse.openk.eisman.adapter.rest.controller.util.IncludeAttribute4Json;
import org.eclipse.openk.eisman.model.AbstractBaseEntitiy;
import org.eclipse.openk.eisman.model.core.SubGeographicalRegion;
import org.eclipse.openk.eisman.model.core.Substation;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SwitchOffAdviceService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SwitchOffAdviceService.java
index 9d1ba7b7..ac057b1f 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SwitchOffAdviceService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SwitchOffAdviceService.java
@@ -12,8 +12,9 @@
*/
package org.eclipse.openk.eisman.service;
-import org.eclipse.openk.eisman.adapter.rest.SubGeographicalRegionRestConsumer;
-import org.eclipse.openk.eisman.adapter.rest.SubstationRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SubGeographicalRegionRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SubstationRestConsumer;
+import org.eclipse.openk.eisman.adapter.rest.consumer.SynchronousMachineRestConsumer;
import org.eclipse.openk.eisman.model.core.Substation;
import org.eclipse.openk.eisman.model.process.Activity;
import org.eclipse.openk.eisman.model.wires.SynchronousMachine;
@@ -31,6 +32,9 @@ public class SwitchOffAdviceService {
@Autowired
private SubstationRestConsumer substationRestConsumer;
+ @Autowired
+ private SynchronousMachineRestConsumer synchronousMachineRestConsumer;
+
/**
* Calculate the advie for an activity.
*/
@@ -48,7 +52,7 @@ public class SwitchOffAdviceService {
for (final Substation substation : activity.getSubstationList()) {
final List<SynchronousMachine> synchronousMachineList =
- substationRestConsumer.getSynchronousMachineListOfSubstation(substation.getmRid());
+ synchronousMachineRestConsumer.getSynchronousMachineListOfSubstation(substation.getmRid());
// todo: die ids entfernen
substation.setSynchronousMachineList(synchronousMachineList);
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/webapp/WEB-INF/restful-servlet.xml b/openk-platform/openk-eisman-portlet/src/main/webapp/WEB-INF/restful-servlet.xml
index b4a18944..9ea3434f 100644
--- a/openk-platform/openk-eisman-portlet/src/main/webapp/WEB-INF/restful-servlet.xml
+++ b/openk-platform/openk-eisman-portlet/src/main/webapp/WEB-INF/restful-servlet.xml
@@ -17,7 +17,7 @@
http://hmkcode.com/spring-mvc-return-json-using-responseboyd/
-->
<context:component-scan
- base-package="org.eclipse.openk.eisman.controller.rest,
+ base-package="org.eclipse.openk.eisman.controller,
org.eclipse.openk.eisman.adapter.rest,
org.eclipse.openk.eisman.service"/>

Back to the top