Bugfix relation management
This commit is contained in:
parent
1aa4a43b95
commit
df4e62cfcc
|
@ -339,13 +339,16 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
|||
Project toUpdate=lock(id,"Delete Relation");
|
||||
|
||||
try{
|
||||
// SET target UCD to present UCD as default
|
||||
final String toUseTargetUCD = (targetUCD == null || targetUCD.equals(""))? getUseCaseDescriptor().getId():targetUCD;
|
||||
|
||||
// check if relation existing
|
||||
List<Relationship> relations = toUpdate.getRelationships();
|
||||
if(relations!=null && !relations.isEmpty()){
|
||||
int beforeSize = relations.size();
|
||||
toUpdate.getRelationships().removeIf(r ->
|
||||
r.getRelationshipName().equals(relation)&&
|
||||
r.getTargetUCD().equals(targetUCD)&&
|
||||
r.getTargetUCD().equals(toUseTargetUCD)&&
|
||||
r.getTargetID().equals(targetId));
|
||||
// update only if something changed
|
||||
if(toUpdate.getRelationships().size()!=beforeSize) {
|
||||
|
|
Loading…
Reference in New Issue