Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjnkruege.btc2016-01-18 07:32:19 -0500
committerjnkruege.btc2016-01-18 07:32:19 -0500
commit2eb814915c1461c3ae12ac589a93bdb9d9dfab09 (patch)
treeca931ed6a52c5bf75ad7ebd1a718025acf98ab3b
parent91c063a9289337e1823300bae6c68e485827f7e3 (diff)
parent691d8f17b9b42428e0656d8ae8a2c328022d37b7 (diff)
downloadorg.eclipse.openk-platform.openk-repo-2eb814915c1461c3ae12ac589a93bdb9d9dfab09.tar.gz
org.eclipse.openk-platform.openk-repo-2eb814915c1461c3ae12ac589a93bdb9d9dfab09.tar.xz
org.eclipse.openk-platform.openk-repo-2eb814915c1461c3ae12ac589a93bdb9d9dfab09.zip
Merge https://git.eclipse.org/r/openk-platform/org.eclipse.openk-platform.openk-repo
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java6
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/ActionOverviewDto.java18
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/OverviewDto.java23
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/AbstractReductionAdviceService.java12
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ActivityJpaService.java23
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceAdjustmentService.java1
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceCalculatorService.java2
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceUpdateService.java33
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SynchronousMachineOrderService.java8
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/main/resources/dozer-mapping.xml8
-rwxr-xr-xopenk-platform/openk-eisman-portlet/src/test/resources/test-dozer-mapping.xml8
11 files changed, 101 insertions, 41 deletions
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java
index a91073d0..4645ec95 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/adapter/rest/controller/ActivityRestController.java
@@ -182,6 +182,7 @@ public class ActivityRestController extends AbstractRestController {
modifyDateFinischedForAction(activityJpaProxy.getParentActivityJpaId().toString(),
activityJpaProxy.getUserSettingsJpa().getDateFinished());
}
+ activityJpaService.handleManualReductions(activityJpaProxy);
return activityJpaService.saveActivityWithParent(activityJpaProxy);
//return activityJpaService.updateActivityJpaSetConfirmation(activityJpaProxy);
}
@@ -214,8 +215,9 @@ public class ActivityRestController extends AbstractRestController {
activityJpaProxy.setDateConfirmed(now());
activityJpaProxy.setUpdatedBy(getUserScreenName());
activityJpaProxy.setDateUpdated(now());
- activityJpaService.prepareJpaMapping(activityJpaProxy);
- activityJpaService.removeSynchronousMachineAndSubstationNotReduced(activityJpaProxy);
+ activityJpaService.handleManualReductions(activityJpaProxy);
+ //activityJpaService.prepareJpaMapping(activityJpaProxy);
+ //activityJpaService.removeSynchronousMachineAndSubstationNotReduced(activityJpaProxy);
final ActivityJpa childActivityJpa = activityJpa.getChildrenActivityJpaList().get(0);
if (null != childActivityJpa.getSubGeographicalRegionJpaList()) {
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/ActionOverviewDto.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/ActionOverviewDto.java
index 0c2c87d0..d615ff9f 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/ActionOverviewDto.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/ActionOverviewDto.java
@@ -12,11 +12,29 @@
*/
package org.eclipse.openk.eisman.model.dto.core;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.sql.Timestamp;
+
@SuppressWarnings("CPD-START")
public class ActionOverviewDto extends OverviewDto {
private int seqNum;
+ @JsonFormat(
+ shape = JsonFormat.Shape.STRING,
+ timezone = "CET"
+ )
+ private Timestamp dateCreated;
+
+ public Timestamp getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(final Timestamp dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
public int getSeqNum() {
return this.seqNum;
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/OverviewDto.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/OverviewDto.java
index 8420f690..c8030ee8 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/OverviewDto.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/model/dto/core/OverviewDto.java
@@ -50,6 +50,11 @@ public class OverviewDto {
private String description;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, timezone = "CET")
+ private Timestamp dateUpdated;
+
+ private String updatedBy;
+
public String getDescription() {
return description;
}
@@ -121,4 +126,22 @@ public class OverviewDto {
public void setDeactivatedBy(final String deactivatedBy) {
this.deactivatedBy = deactivatedBy;
}
+
+ public Timestamp getDateUpdated() {
+ return dateUpdated;
+ }
+
+ public void setDateUpdated(final Timestamp dateUpdated) {
+ this.dateUpdated = dateUpdated;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(final String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/AbstractReductionAdviceService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/AbstractReductionAdviceService.java
index 9c5e5811..90e77333 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/AbstractReductionAdviceService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/AbstractReductionAdviceService.java
@@ -111,20 +111,20 @@ public abstract class AbstractReductionAdviceService extends AbstractService {
getSynchronousMachineListWithSubGeographicalRegionList(activityJpa);
+ // list of Substation/Transformer Stations
+ } else if (activityJpa.getSubstationJpaList() != null && activityJpa.getSubstationJpaList().size() > 0) {
+
+ getSynchronousMachineListWithSubstationList(activityJpa);
+
// list of SubGeographicalRegion
} else if (activityJpa.getSubGeographicalRegionJpaList() != null
&& activityJpa.getSubGeographicalRegionJpaList().size() > 0) {
getSynchronousMachineListWithSubGeographicalRegionList(activityJpa);
-
- // list of Substation/Transformer Stations
- } else if (activityJpa.getSubstationJpaList() != null && activityJpa.getSubstationJpaList().size() >= 0) {
-
- getSynchronousMachineListWithSubstationList(activityJpa);
}
}
- private void getSynchronousMachineListWithSubGeographicalRegionList(final ActivityJpa activityJpa) {
+ public void getSynchronousMachineListWithSubGeographicalRegionList(final ActivityJpa activityJpa) {
for (final SubGeographicalRegionJpa subGeographicalRegionJpa : activityJpa.getSubGeographicalRegionJpaList()) {
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ActivityJpaService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ActivityJpaService.java
index b533f7f3..b9efecbd 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ActivityJpaService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ActivityJpaService.java
@@ -44,11 +44,30 @@ public class ActivityJpaService {
@Autowired
private SynchronousMachineJpaService synchronousMachineJpaService;
- public ActivityJpa saveActivityWithParent(final ActivityJpa activityJpa) {
+ @Autowired
+ private ReductionAdviceUpdateService reductionAdviceUpdateService;
+
+ public void handleManualReductions(final ActivityJpa activityJpa) {
+ reductionAdviceUpdateService.updateActivityChangedReductionList(activityJpa);
- prepareJpaMapping(activityJpa);
//activityJpa.setReductionAdviceNotFulfilled(sumOfReduction.compareTo(valueToBeReduced) == -1);
removeSynchronousMachineAndSubstationNotReduced(activityJpa);
+ prepareJpaMapping(activityJpa);
+
+ // TODO: Find out why referenced sync machines could not be persisted and if its necessary
+ for (final SubGeographicalRegionJpa subGeographicalRegionJpa : activityJpa.getSubGeographicalRegionJpaList()) {
+
+ for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
+
+ for (final SynchronousMachineJpa synchronousMachineJpa : substationJpa.getSynchronousMachineJpaList()) {
+ synchronousMachineJpa.setReferencedSynchronousMachineJpa(null);
+ }
+ }
+ }
+ }
+
+ public ActivityJpa saveActivityWithParent(final ActivityJpa activityJpa) {
+
if (activityJpa.getParentActivityJpaId() == null) {
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceAdjustmentService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceAdjustmentService.java
index ad866ebb..ff5c11ce 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceAdjustmentService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceAdjustmentService.java
@@ -42,6 +42,7 @@ public class ReductionAdviceAdjustmentService extends AbstractReductionAdviceSer
activityJpaFindService.findActivity(activityJpa.getParentActivityJpaId())));
activityJpa.setSubGeographicalRegionJpaList(latestConfirmedChildActivity.getSubGeographicalRegionJpaList());
+ activityJpa.setSubstationJpaList(latestConfirmedChildActivity.getSubstationJpaList());
final List<SynchronousMachineJpa> synchronousMachineJpaListAlredyReduced =
activityJpaService.getSynchronousMachineListOfActivity(latestConfirmedChildActivity);
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceCalculatorService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceCalculatorService.java
index af302893..1985929d 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceCalculatorService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceCalculatorService.java
@@ -125,7 +125,7 @@ public class ReductionAdviceCalculatorService extends AbstractReductionAdviceCal
}
activityJpa.setReductionAdviceNotFulfilled(sumOfReduction.compareTo(valueToBeReduced) == -1);
- //activityJpaService.removeSynchronousMachineAndSubstationNotReduced(activityJpa);
+ activityJpaService.removeSynchronousMachineAndSubstationNotReduced(activityJpa);
logCalculationEnd(sumOfReduction);
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceUpdateService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceUpdateService.java
index a941800a..847a6bd6 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceUpdateService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/ReductionAdviceUpdateService.java
@@ -12,10 +12,8 @@
*/
package org.eclipse.openk.eisman.service;
-import org.apache.commons.collections.CollectionUtils;
import org.eclipse.openk.eisman.model.jpa.core.SubGeographicalRegionJpa;
import org.eclipse.openk.eisman.model.jpa.core.SubstationJpa;
-import org.eclipse.openk.eisman.model.jpa.meas.AnalogJpa;
import org.eclipse.openk.eisman.model.jpa.process.ActivityJpa;
import org.eclipse.openk.eisman.model.jpa.wires.SynchronousMachineJpa;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +44,9 @@ public class ReductionAdviceUpdateService {
@Autowired
private SubstationJpaService substationJpaService;
+ @Autowired
+ private ReductionAdviceService reductionAdviceService;
+
public ActivityJpa updateActivity(final ActivityJpa activityJpa) {
updateActivityChangedReductionList(activityJpa);
@@ -61,31 +62,24 @@ public class ReductionAdviceUpdateService {
}
}
- private void updateActivityChangedReductionList(final ActivityJpa activityJpa) {
-
- final ActivityJpa activityJpaPersisted = activityJpaFindService.findActivity(activityJpa.getId());
- activityJpa.setSubGeographicalRegionJpaList(activityJpaPersisted.getSubGeographicalRegionJpaList());
+ public void updateActivityChangedReductionList(final ActivityJpa activityJpa) {
final List<SynchronousMachineJpa> synchronousMachineJpaListToBeAdded = new ArrayList<>();
final List<SynchronousMachineJpa> synchronousMachineJpaListJunction = new ArrayList<>();
-
for (final SynchronousMachineJpa synchronousMachineJpaToBeReduced : activityJpa.getSynchronousMachineJpaReducedList()) {
boolean exists = false;
for (final SynchronousMachineJpa synchronousMachineJpaPersisted :
- activityJpaService.getSynchronousMachineListOfActivity(activityJpaPersisted)) {
+ activityJpaService.getSynchronousMachineListOfActivity(activityJpa)) {
if (synchronousMachineJpaService.isSame(synchronousMachineJpaPersisted, synchronousMachineJpaToBeReduced)) {
exists = true;
synchronousMachineJpaListJunction.add(synchronousMachineJpaPersisted);
-
- if (synchronousMachineJpaPersisted.getReductionAdvice()
- .compareTo(synchronousMachineJpaToBeReduced.getReductionAdvice()) == 0) {
-
- synchronousMachineJpaPersisted.setReductionAdvice(synchronousMachineJpaToBeReduced.getReductionAdvice());
- }
+ synchronousMachineJpaPersisted.setReductionAdvice(synchronousMachineJpaToBeReduced.getReductionAdvice());
+ synchronousMachineJpaPersisted.setActivePowerJpaToBeReduced(synchronousMachineJpaToBeReduced
+ .getActivePowerJpaToBeReduced());
}
}
@@ -95,11 +89,6 @@ public class ReductionAdviceUpdateService {
}
}
- final List<SynchronousMachineJpa> synchronousMachineJpaListToBeDeleted =
- (List) CollectionUtils.disjunction(
- activityJpaService.getSynchronousMachineListOfActivity(activityJpaPersisted),
- synchronousMachineJpaListJunction);
-
for (final SynchronousMachineJpa synchronousMachineJpaToBeAdded : synchronousMachineJpaListToBeAdded) {
final SubGeographicalRegionJpa subGeographicalRegionJpaToBeAdded =
@@ -158,10 +147,10 @@ public class ReductionAdviceUpdateService {
}
}
- delete(activityJpa, synchronousMachineJpaListToBeDeleted);
+ //delete(activityJpa, synchronousMachineJpaListToBeDeleted);
}
- private void delete(final ActivityJpa activityJpa,
+/* private void delete(final ActivityJpa activityJpa,
final List<SynchronousMachineJpa> synchronousMachineJpaListToBeDeleted) {
for (final SynchronousMachineJpa synchronousMachineJpa : synchronousMachineJpaListToBeDeleted) {
@@ -215,6 +204,6 @@ public class ReductionAdviceUpdateService {
}
}
}
- }
+ }*/
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SynchronousMachineOrderService.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SynchronousMachineOrderService.java
index d79a4b7c..68f03303 100755
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SynchronousMachineOrderService.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/service/SynchronousMachineOrderService.java
@@ -43,10 +43,10 @@ public class SynchronousMachineOrderService {
return Double.compare(
sm1.getDiscriminatorCoefficient() == null ? 0 : sm1.getDiscriminatorCoefficient()
+ sm1.getFeedInPriority()
- + sm1.getFeedInRandomNumber(),
+ + (sm1.getFeedInRandomNumber() == null ? 0 : sm1.getFeedInRandomNumber()),
sm2.getDiscriminatorCoefficient() == null ? 0 : sm2.getDiscriminatorCoefficient()
+ sm2.getFeedInPriority()
- + sm2.getFeedInRandomNumber());
+ + (sm2.getFeedInRandomNumber() == null ? 0 : sm2.getFeedInRandomNumber()));
}
};
@@ -54,8 +54,8 @@ public class SynchronousMachineOrderService {
@Override
public int compare(final SynchronousMachineJpa sm1, final SynchronousMachineJpa sm2) {
return Double.compare(
- sm1.getFeedInPriority() + sm1.getFeedInRandomNumber(),
- sm2.getFeedInPriority() + sm2.getFeedInRandomNumber());
+ sm1.getFeedInPriority() + (sm1.getFeedInRandomNumber() == null ? 0 : sm1.getFeedInRandomNumber()),
+ sm2.getFeedInPriority() + (sm2.getFeedInRandomNumber() == null ? 0 : sm2.getFeedInRandomNumber()));
}
};
diff --git a/openk-platform/openk-eisman-portlet/src/main/resources/dozer-mapping.xml b/openk-platform/openk-eisman-portlet/src/main/resources/dozer-mapping.xml
index 3ae2aa9a..c8b4a26e 100755
--- a/openk-platform/openk-eisman-portlet/src/main/resources/dozer-mapping.xml
+++ b/openk-platform/openk-eisman-portlet/src/main/resources/dozer-mapping.xml
@@ -245,11 +245,11 @@
<a>childrenActivityJpaList[0].userSettingsJpa.geographicalRegion</a>
<b>geographicalRegion</b>
</field>
- <field>
+ <field copy-by-reference="true">
<a>childrenActivityJpaList[0].subGeographicalRegionJpaList</a>
<b>subGeographicalRegionJpaList</b>
</field>
- <field>
+ <field copy-by-reference="true">
<a>childrenActivityJpaList[0].substationJpaList</a>
<b>substationJpaList</b>
</field>
@@ -322,6 +322,10 @@
<a>preselectionConfigurationJpa</a>
<b>preselectionConfigurationDto</b>
</field>
+ <field copy-by-reference="true">
+ <a>substationJpaList</a>
+ <b>substationJpaList</b>
+ </field>
</mapping>
<mapping>
<class-a>org.eclipse.openk.eisman.model.jpa.process.PreselectionConfigurationJpa</class-a>
diff --git a/openk-platform/openk-eisman-portlet/src/test/resources/test-dozer-mapping.xml b/openk-platform/openk-eisman-portlet/src/test/resources/test-dozer-mapping.xml
index 1cf7f77e..01400deb 100755
--- a/openk-platform/openk-eisman-portlet/src/test/resources/test-dozer-mapping.xml
+++ b/openk-platform/openk-eisman-portlet/src/test/resources/test-dozer-mapping.xml
@@ -245,11 +245,11 @@
<a>childrenActivityJpaList[0].userSettingsJpa.geographicalRegion</a>
<b>geographicalRegion</b>
</field>
- <field>
+ <field copy-by-reference="true">
<a>childrenActivityJpaList[0].subGeographicalRegionJpaList</a>
<b>subGeographicalRegionJpaList</b>
</field>
- <field>
+ <field copy-by-reference="true">
<a>childrenActivityJpaList[0].substationJpaList</a>
<b>substationJpaList</b>
</field>
@@ -322,6 +322,10 @@
<a>preselectionConfigurationJpa</a>
<b>preselectionConfigurationDto</b>
</field>
+ <field copy-by-reference="true">
+ <a>substationJpaList</a>
+ <b>substationJpaList</b>
+ </field>
</mapping>
<mapping>
<class-a>org.eclipse.openk.eisman.model.jpa.process.PreselectionConfigurationJpa</class-a>

Back to the top