Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

840 fix databaseconstraint exceptions #841

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private void runsimLoop() {

BioModel templateBioModel = XmlHelper.XMLToBioModel(new XMLSource(vcmlString));
templateBioModel.clearVersion();
templateBioModel.visitChildVersionables(new BioModel.ClearVersion());
templateBioModel.visitChildVersionables(new BioModel.SetRandomVersionKeys());
String newBiomodelName = "test_"+System.currentTimeMillis();
templateBioModel.setName(newBiomodelName);
// remove all existing simulations from stored template model, and add new one
Expand Down
9 changes: 9 additions & 0 deletions vcell-core/src/main/java/cbit/vcell/biomodel/BioModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ public void accept(Versionable versionable) {
}
}

public final static class SetRandomVersionKeys implements Consumer<Versionable> {
@Override
public void accept(Versionable versionable) {
if (versionable.getVersion()!=null){
versionable.getVersion().testFixtureRandomizeKeys();
}
}
}

public void visitChildVersionables(Consumer<Versionable> operation) {
operation.accept(getModel());
for (SimulationContext sc : getSimulationContexts()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public SimulationVersion(KeyValue versionKeyNew, String versionNameNew, org.vcel
this.parentSimulationReference = argParentSimulationReference;
}

@Deprecated
public void testFixtureRandomizeKeys() {
super.testFixtureRandomizeKeys();
parentSimulationReference = null;
}

/**
* Insert the method's description here.
Expand Down
11 changes: 7 additions & 4 deletions vcell-core/src/main/java/org/vcell/util/document/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.*;

import org.vcell.util.BeanUtils;
import org.vcell.util.Compare;
Expand Down Expand Up @@ -59,6 +56,12 @@ public Version(String name, User owner) {
this.versionOwner = owner;
}

@Deprecated
public void testFixtureRandomizeKeys() {
versionKey = new KeyValue(Long.toString(new Random().nextLong()));
versionBranchID = new BigDecimal(Long.toString(new Random().nextLong()));
}

public List<Object> compare(Object obj) {

List<Object> diff = new ArrayList<Object>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ public String saveBioModel(QueryHashtable dbc, User user, String bioModelXML, St
List<BioModel.VersionableInfo> versionableInfos = origBioModel.gatherChildVersionableInfos();
lg.info("Cached Biomodel("+key+"): "+versionableInfos);
}
// }else{
// User forceClearVersionUser = new User("forceClearVersionUser",new KeyValue("0"));
// forceDeepDirtyIfForeign(forceClearVersionUser, bioModel);
}

boolean bSomethingChanged = false;
Expand Down
Loading