Skip to content

Commit

Permalink
Specify current user for new NE
Browse files Browse the repository at this point in the history
  • Loading branch information
safrant committed Sep 3, 2021
1 parent aeabcbe commit a6f38b0
Showing 1 changed file with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
SimpleNanomaterialEntityBean nanoBean, HttpServletRequest request) {
NanomaterialEntityBean nanomaterialEntityBean = new NanomaterialEntityBean();
NanomaterialEntity nanoEntity = null;

String currentUser = SpringSecurityUtil.getLoggedInUserName();
Collection<ComposingElement> coll = new HashSet<ComposingElement>();
Collection<File> filecoll = new HashSet<File>();
//setting up sampleComposition
Expand Down Expand Up @@ -430,7 +430,6 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
comp.setCreatedBy(nanoBean.getCreatedBy());
comp.setCreatedDate(nanoBean.getCreatedDate());
} else {
String currentUser = SpringSecurityUtil.getLoggedInUserName();
comp.setCreatedBy(currentUser);
comp.setCreatedDate(Calendar.getInstance().getTime());
}
Expand Down Expand Up @@ -474,8 +473,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
function.setCreatedBy((String) funclist.get(j).get("createdBy"));
function.setCreatedDate(new Date((Long) funclist.get(j).get("createdDate")));
} else {
function.setCreatedBy(nanoBean.getCreatedBy());
function.setCreatedDate(nanoBean.getCreatedDate());
function.setCreatedBy(currentUser);
function.setCreatedDate(Calendar.getInstance().getTime());
}
functionBean.setDomainFunction(function);
hash.add(function);
Expand Down Expand Up @@ -520,8 +519,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
comp.setCreatedDate(simpleComp.getCreatedDate());
} else {
//TODO see if there is a way to grab user directly
comp.setCreatedBy(nanoBean.getCreatedBy());
comp.setCreatedDate(nanoBean.getCreatedDate());
comp.setCreatedBy(currentUser);
comp.setCreatedDate(Calendar.getInstance().getTime());
}
comp.setCreatedBy(simpleComp.getCreatedBy());
comp.setCreatedDate(simpleComp.getCreatedDate());
Expand Down Expand Up @@ -556,8 +555,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
function.setCreatedBy((String) funclist.get(j).get("createdBy"));
function.setCreatedDate(new Date((Long) funclist.get(j).get("createdDate")));
} else {
function.setCreatedBy(nanoBean.getCreatedBy());
function.setCreatedDate(nanoBean.getCreatedDate());
function.setCreatedBy(currentUser);
function.setCreatedDate(Calendar.getInstance().getTime());
}
hash.add(function);
functionBean.setDomainFunction(function);
Expand Down Expand Up @@ -658,6 +657,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
fullerene.setSampleComposition(sampleComp);
} else {
fullerene.setSampleComposition(null);
fullerene.setCreatedBy(currentUser);
fullerene.setCreatedDate(Calendar.getInstance().getTime());
}
}
fullerene.setComposingElementCollection(coll);
Expand All @@ -678,6 +679,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
den.setSampleComposition(sampleComp);
} else {
den.setSampleComposition(null);
den.setCreatedBy(currentUser);
den.setCreatedDate(Calendar.getInstance().getTime());
}
}
den.setComposingElementCollection(coll);
Expand All @@ -700,6 +703,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
bio.setSampleComposition(sampleComp);
} else {
bio.setSampleComposition(null);
bio.setCreatedBy(currentUser);
bio.setCreatedDate(Calendar.getInstance().getTime());
}
}
bio.setComposingElementCollection(coll);
Expand All @@ -723,6 +728,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
lipo.setSampleComposition(sampleComp);
} else {
lipo.setSampleComposition(null);
lipo.setCreatedBy(currentUser);
lipo.setCreatedDate(Calendar.getInstance().getTime());
}
}
lipo.setComposingElementCollection(coll);
Expand All @@ -745,6 +752,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
em.setSampleComposition(sampleComp);
} else {
em.setSampleComposition(null);
em.setCreatedBy(currentUser);
em.setCreatedDate(Calendar.getInstance().getTime());
}
}
em.setComposingElementCollection(coll);
Expand All @@ -769,6 +778,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
poly.setSampleComposition(sampleComp);
} else {
poly.setSampleComposition(null);
poly.setCreatedBy(currentUser);
poly.setCreatedDate(Calendar.getInstance().getTime());
}
}
poly.setComposingElementCollection(coll);
Expand Down Expand Up @@ -797,6 +808,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(
ctube.setSampleComposition(sampleComp);
} else {
ctube.setSampleComposition(null);
ctube.setCreatedBy(currentUser);
ctube.setCreatedDate(Calendar.getInstance().getTime());
}
}
ctube.setComposingElementCollection(coll);
Expand All @@ -815,6 +828,8 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean(

} else
nanoEntity.setSampleComposition(null);
nanoEntity.setCreatedBy(currentUser);
nanoEntity.setCreatedDate(Calendar.getInstance().getTime());
}
nanoEntity.setComposingElementCollection(coll);

Expand Down

0 comments on commit a6f38b0

Please sign in to comment.