diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/dto/particle/composition/NanomaterialEntityBean.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/dto/particle/composition/NanomaterialEntityBean.java index 17d831d357..c8eb7670c4 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/dto/particle/composition/NanomaterialEntityBean.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/dto/particle/composition/NanomaterialEntityBean.java @@ -341,13 +341,13 @@ public boolean isWithProperties() { return withProperties; } -// public ComposingElementBean getTheComposingElement() { -// return theComposingElement; -// } + public ComposingElementBean getTheComposingElement() { + return theComposingElement; + } -// public void setTheComposingElement(ComposingElementBean theComposingElement) { -// this.theComposingElement = theComposingElement; -// } + public void setTheComposingElement(ComposingElementBean theComposingElement) { + this.theComposingElement = theComposingElement; + } // used for DWR ajax in bodySubmitChemicalAssociation.jsp public String getDomainId() { diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/NanomaterialEntityServices.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/NanomaterialEntityServices.java index 814457c098..3a880323fc 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/NanomaterialEntityServices.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/NanomaterialEntityServices.java @@ -40,7 +40,7 @@ public Response setup(@Context HttpServletRequest httpRequest, @DefaultValue("") return Response.ok(dropdownMap).header("Access-Control-Allow-Credentials", "true").header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS").header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization").build(); } catch (Exception e) { - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(CommonUtil.wrapErrorMessageInList("Error while setting up drop down lists " + e.getMessage())).build(); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(CommonUtil.wrapErrorMessageInList("Error while setting up drop down lists" + e.getMessage())).build(); } } @@ -98,7 +98,7 @@ public Response saveComposingElement(@Context HttpServletRequest httpRequest, Si @POST @Path("/removeComposingElement") @Produces ("application/json") - public Response removeComposingElement(@Context HttpServletRequest httpRequest, @DefaultValue("") @QueryParam("composingElementId") String composingElementId, SimpleNanomaterialEntityBean nanoBean) { + public Response removeComposingElement(@Context HttpServletRequest httpRequest, SimpleNanomaterialEntityBean nanoBean) { try { NanomaterialEntityBO nanomaterialEntityBO = @@ -107,7 +107,7 @@ public Response removeComposingElement(@Context HttpServletRequest httpRequest, return Response.status(Response.Status.UNAUTHORIZED) .entity("Session expired").build(); - SimpleNanomaterialEntityBean nano = nanomaterialEntityBO.removeComposingElement(nanoBean, composingElementId, httpRequest); + SimpleNanomaterialEntityBean nano = nanomaterialEntityBO.removeComposingElement(nanoBean, httpRequest); List errors = nano.getErrors(); return (errors == null || errors.size() == 0) ? Response.ok(nano).build() : diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/InitCompositionSetup.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/InitCompositionSetup.java index 393f1be023..aa8685f96f 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/InitCompositionSetup.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/InitCompositionSetup.java @@ -87,36 +87,31 @@ public void persistNanomaterialEntityDropdowns(HttpServletRequest request, "averageLengthUnit", "otherAverageLengthUnit", entityBean.getCarbonNanotube().getAverageLengthUnit()); - List ces = entityBean.getComposingElements(); - if (ces.size()>0) { - - - ComposingElementBean theComposingElement = entityBean - .getComposingElements().get(0); - if (entityBean.getDomainEntity() instanceof Emulsion) { - InitSetup.getInstance().persistLookup(request, "emulsion", - "composingElementType", "otherComposingElementType", - theComposingElement.getDomain().getType()); - } else { - InitSetup.getInstance().persistLookup(request, "composing element", - "type", "otherType", - theComposingElement.getDomain().getType()); - } + ComposingElementBean theComposingElement = entityBean + .getTheComposingElement(); + if (entityBean.getDomainEntity() instanceof Emulsion) { + InitSetup.getInstance().persistLookup(request, "emulsion", + "composingElementType", "otherComposingElementType", + theComposingElement.getDomain().getType()); + } else { InitSetup.getInstance().persistLookup(request, "composing element", - "valueUnit", "otherValueUnit", - theComposingElement.getDomain().getValueUnit()); - InitSetup.getInstance().persistLookup(request, "molecular formula", "type", "otherType", - theComposingElement.getDomain().getMolecularFormulaType()); - - InitSetup.getInstance().persistLookup( - request, - "imaging function", - "modality", - "otherModality", - theComposingElement.getTheFunction().getImagingFunction() - .getModality()); + theComposingElement.getDomain().getType()); } + InitSetup.getInstance().persistLookup(request, "composing element", + "valueUnit", "otherValueUnit", + theComposingElement.getDomain().getValueUnit()); + InitSetup.getInstance().persistLookup(request, "molecular formula", + "type", "otherType", + theComposingElement.getDomain().getMolecularFormulaType()); + + InitSetup.getInstance().persistLookup( + request, + "imaging function", + "modality", + "otherModality", + theComposingElement.getTheFunction().getImagingFunction() + .getModality()); InitSetup.getInstance().persistLookup(request, "file", "type", "otherType", entityBean.getTheFile().getDomainFile().getType()); diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/NanomaterialEntityBO.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/NanomaterialEntityBO.java index e828cd1ef2..caa1379f66 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/NanomaterialEntityBO.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/sample/NanomaterialEntityBO.java @@ -361,14 +361,9 @@ public SimpleNanomaterialEntityBean saveComposingElement(SimpleNanomaterialEntit try { entity = transferNanoMateriaEntityBean(nanoBean, request); List msgs =new ArrayList(); - - List composingElements = entity.getComposingElements(); -// ComposingElementBean composingElement = entity.getTheComposingElement(); -// composingElement.setupDomain(SpringSecurityUtil.getLoggedInUserName()); - for(ComposingElementBean element:composingElements) { - - element.setupDomain(SpringSecurityUtil.getLoggedInUserName()); - } + ComposingElementBean composingElement = entity.getTheComposingElement(); +// ComposingElementBean composingElement = entity.getComposingElements().get(0); + composingElement.setupDomain(SpringSecurityUtil.getLoggedInUserName()); // entity.addComposingElement(composingElement); // save nanomaterial entity @@ -380,7 +375,7 @@ public SimpleNanomaterialEntityBean saveComposingElement(SimpleNanomaterialEntit } msgs = this.saveEntity(request, sampleId, entity); - compositionService.assignAccesses(composingElements.get(0).getDomain()); + compositionService.assignAccesses(composingElement.getDomain()); // return to setupUpdate to retrieve the correct entity from database // after saving to database. @@ -396,7 +391,7 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean( NanomaterialEntityBean bean = new NanomaterialEntityBean(); NanomaterialEntity nanoEntity = null; - Collection composingElementCollection = new HashSet(); + Collection coll = new HashSet(); Collection filecoll = new HashSet(); //setting up sampleComposition //Managed to get the sampleComposition in the backend to avoid lazy loading things @@ -409,89 +404,81 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean( } //Setting up the ComposingElement -// ComposingElementBean compBean = new ComposingElementBean(); + ComposingElementBean compBean = new ComposingElementBean(); + + SimpleComposingElementBean sBean = nanoBean.getSimpleCompBean(); + + ComposingElement comp = new ComposingElement(); -// SimpleComposingElementBean sBean = nanoBean.getSimpleCompBean(); -// List lsBeans = nanoBean.getComposingElements(); -// -// ComposingElement comp = new ComposingElement(); -// FunctionBean func = new FunctionBean(); ImagingFunction img = new ImagingFunction(); Collection hash = new HashSet(); List> funclist; List inherentFunctions = new ArrayList(); List compList = new ArrayList(); -// for(SimpleComposingElementBean sBean: lsBeans) { -// ComposingElement comp = new ComposingElement(); -// -// if(sBean!=null){ -// comp.setDescription(sBean.getDescription()); -// comp.setType(sBean.getType()); -// comp.setName(sBean.getName()); -// comp.setPubChemDataSourceName(sBean.getPubChemDataSourceName()); -// comp.setPubChemId(sBean.getPubChemId()); -// if((sBean.getId()!=null)&&(sBean.getId()>0)){ -// comp.setId(sBean.getId()); -// comp.setCreatedBy(sBean.getCreatedBy()); -// comp.setCreatedDate(sBean.getCreatedDate()); -// } else { -// //TODO see if there is a way to grab user directly -// comp.setCreatedBy(nanoBean.getCreatedBy()); -// comp.setCreatedDate(nanoBean.getCreatedDate()); -// } -// comp.setMolecularFormula(sBean.getMolecularFormula()); -// comp.setMolecularFormulaType(sBean.getMolecularFormulaType()); -// comp.setValue(sBean.getValue()); -// comp.setValueUnit(sBean.getValueUnit()); -// funclist = sBean.getInherentFunction(); -// if(funclist!= null){ -// for(int j=0;j0){ -// function.setCreatedBy((String) funclist.get(j).get("createdBy")); -// function.setCreatedDate(new Date((Long) funclist.get(j).get("createdDate"))); -// function.setId(new Long((String) funclist.get(j).get("id"))); -// }else { -// function.setCreatedBy(nanoBean.getCreatedBy()); -// function.setCreatedDate(nanoBean.getCreatedDate()); -// } -// func.setDomainFunction(function); -// hash.add(function); -// inherentFunctions.add(func); -// -// } -// } -// compBean.setTheFunction(func); -// compBean.setDomain(comp); -// compBean.setInherentFunctions(inherentFunctions); -// -// bean.addComposingElement(compBean); -//// bean.setTheComposingElement(compBean); -// compList.add(compBean); -// } -// } + if(sBean!=null){ + comp.setDescription(sBean.getDescription()); + comp.setType(sBean.getType()); + comp.setName(sBean.getName()); + comp.setPubChemDataSourceName(sBean.getPubChemDataSourceName()); + comp.setPubChemId(sBean.getPubChemId()); + if((sBean.getId()!=null)&&(sBean.getId()>0)){ + comp.setId(sBean.getId()); + comp.setCreatedBy(sBean.getCreatedBy()); + comp.setCreatedDate(sBean.getCreatedDate()); + } else { + //TODO see if there is a way to grab user directly + comp.setCreatedBy(nanoBean.getCreatedBy()); + comp.setCreatedDate(nanoBean.getCreatedDate()); + } + comp.setMolecularFormula(sBean.getMolecularFormula()); + comp.setMolecularFormulaType(sBean.getMolecularFormulaType()); + comp.setValue(sBean.getValue()); + comp.setValueUnit(sBean.getValueUnit()); + funclist = sBean.getInherentFunction(); + if(funclist!= null){ + for(int j=0;j0){ + function.setCreatedBy((String) funclist.get(j).get("createdBy")); + function.setCreatedDate(new Date((Long) funclist.get(j).get("createdDate"))); + function.setId(new Long((String) funclist.get(j).get("id"))); + }else { + function.setCreatedBy(nanoBean.getCreatedBy()); + function.setCreatedDate(nanoBean.getCreatedDate()); + } + func.setDomainFunction(function); + hash.add(function); + inherentFunctions.add(func); + + } + } + compBean.setTheFunction(func); + compBean.setDomain(comp); + compBean.setInherentFunctions(inherentFunctions); + + bean.addComposingElement(compBean); + bean.setTheComposingElement(compBean); + compList.add(compBean); + } //setting up composing elements if there exists composingElements List list = nanoBean.getComposingElements(); - + func = new FunctionBean(); img = new ImagingFunction(); - - + hash = new HashSet(); // List compList = new ArrayList(); if(list!=null){ for(SimpleComposingElementBean simpleComp : list){ - ComposingElementBean compBean = new ComposingElementBean(); - ComposingElement comp = new ComposingElement(); - inherentFunctions = new ArrayList(); - hash = new HashSet(); + compBean = new ComposingElementBean(); + comp = new ComposingElement(); comp.setDescription(simpleComp.getDescription()); comp.setType(simpleComp.getType()); comp.setName(simpleComp.getName()); @@ -507,7 +494,6 @@ private NanomaterialEntityBean transferNanoMateriaEntityBean( funclist = simpleComp.getInherentFunction(); if(funclist!= null){ for(int j=0;j msgs = new ArrayList(); NanomaterialEntityBean entity = transferNanoMateriaEntityBean(nanoBean, request); -// ComposingElementBean composingElement = entity.getTheComposingElement(); - - List composingElements = entity.getComposingElements(); - ComposingElementBean composingElement = compositionService.findComposingElementByID(composingElementId); - + ComposingElementBean composingElement = entity.getTheComposingElement(); +// ComposingElementBean composingElement = entity.getComposingElements().get(0); + //TODO EH. what? So it doesn't even check what composing element to remove? I don't even.... + // check if composing element is associated with an association SimpleNanomaterialEntityBean nano = new SimpleNanomaterialEntityBean(); if (!compositionService.checkChemicalAssociationBeforeDelete(entity @@ -930,15 +913,12 @@ private void checkOpenForms(NanomaterialEntityBean entity, HttpServletRequest re String entityType = entity.getType(); setOtherValueOption(request, entityType, "nanomaterialEntityTypes"); // function type - //TODO This only grabs the first, which is dumb. Fix it - List ces = entity.getComposingElements(); - if(ces.size()>0) { - String functionType = entity.getComposingElements().get(0).getTheFunction() - .getType(); + String functionType = entity.getTheComposingElement().getTheFunction() + .getType(); + + setOtherValueOption(request, functionType, "functionTypes"); - setOtherValueOption(request, functionType, "functionTypes"); - } String detailPage = null; if (entity.isWithProperties()) { if (!StringUtils.isEmpty(entity.getType())) { diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/view/edit/SimpleNanomaterialEntityBean.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/view/edit/SimpleNanomaterialEntityBean.java index d8fc20daf9..8ae394f664 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/view/edit/SimpleNanomaterialEntityBean.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/view/edit/SimpleNanomaterialEntityBean.java @@ -33,7 +33,7 @@ public class SimpleNanomaterialEntityBean { -// SimpleComposingElementBean simpleCompBean; + SimpleComposingElementBean simpleCompBean; SimpleSampleComposition sampleComposition; @@ -112,13 +112,13 @@ public void setErrors(List errors) { this.errors = errors; } -// public SimpleComposingElementBean getSimpleCompBean() { -// return simpleCompBean; -// } -// -// public void setSimpleCompBean(SimpleComposingElementBean simpleCompBean) { -// this.simpleCompBean = simpleCompBean; -// } + public SimpleComposingElementBean getSimpleCompBean() { + return simpleCompBean; + } + + public void setSimpleCompBean(SimpleComposingElementBean simpleCompBean) { + this.simpleCompBean = simpleCompBean; + } public SimpleFileBean getFileBean() { return fileBean; diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/CompositionService.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/CompositionService.java index 0879f86add..64cca4d957 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/CompositionService.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/CompositionService.java @@ -20,7 +20,6 @@ import gov.nih.nci.cananolab.dto.particle.SampleBean; import gov.nih.nci.cananolab.dto.particle.composition.ChemicalAssociationBean; import gov.nih.nci.cananolab.dto.particle.composition.CompositionBean; -import gov.nih.nci.cananolab.dto.particle.composition.ComposingElementBean; import gov.nih.nci.cananolab.dto.particle.composition.FunctionalizingEntityBean; import gov.nih.nci.cananolab.dto.particle.composition.NanomaterialEntityBean; import gov.nih.nci.cananolab.exception.ChemicalAssociationViolationException; @@ -53,9 +52,6 @@ public void saveChemicalAssociation(SampleBean sampleBean, public void saveCompositionFile(SampleBean sampleBean, FileBean fileBean) throws CompositionException, NoAccessException; - - public ComposingElementBean findComposingElementByID(String composingElementId) - throws CompositionException, NoAccessException; public FunctionalizingEntityBean findFunctionalizingEntityById(String sampleId, String entityId) throws CompositionException, NoAccessException; diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/helper/CompositionServiceHelper.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/helper/CompositionServiceHelper.java index 3f1563f925..f7f0bdf7ab 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/helper/CompositionServiceHelper.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/helper/CompositionServiceHelper.java @@ -123,6 +123,7 @@ public SampleComposition findCompositionBySampleId(String sampleId) throws Excep new NoAccessException("User has no access to the sample " + sampleId); } SampleComposition composition = null; + CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService(); DetachedCriteria crit = DetachedCriteria.forClass(SampleComposition.class); crit.createAlias("sample", "sample"); @@ -168,16 +169,10 @@ public NanomaterialEntity findNanomaterialEntityById(String sampleId, String ent !springSecurityAclService.currentUserHasWritePermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz())) { new NoAccessException("User has no access to the nanomaterial entity " + entityId); } - Long longID = null; - try { - longID = new Long(entityId); - Property pID = Property.forName("id"); - } catch (Exception e){ - throw e; - } CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService(); + DetachedCriteria crit = DetachedCriteria.forClass(NanomaterialEntity.class).add( - Property.forName("id").eq(longID)); + Property.forName("id").eq(new Long(entityId))); crit.setFetchMode("sampleComposition", FetchMode.JOIN); crit.setFetchMode("sampleComposition.chemicalAssociationCollection", FetchMode.JOIN); crit.setFetchMode("sampleComposition.chemicalAssociationCollection.associatedElementA", FetchMode.JOIN); diff --git a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/impl/CompositionServiceLocalImpl.java b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/impl/CompositionServiceLocalImpl.java index ade520f319..5c860e9140 100644 --- a/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/impl/CompositionServiceLocalImpl.java +++ b/software/cananolab-webapp/src/gov/nih/nci/cananolab/service/sample/impl/CompositionServiceLocalImpl.java @@ -21,7 +21,6 @@ import gov.nih.nci.cananolab.dto.particle.SampleBean; import gov.nih.nci.cananolab.dto.particle.composition.ChemicalAssociationBean; import gov.nih.nci.cananolab.dto.particle.composition.CompositionBean; -import gov.nih.nci.cananolab.dto.particle.composition.ComposingElementBean; import gov.nih.nci.cananolab.dto.particle.composition.FunctionalizingEntityBean; import gov.nih.nci.cananolab.dto.particle.composition.NanomaterialEntityBean; import gov.nih.nci.cananolab.exception.ChemicalAssociationViolationException; @@ -420,25 +419,6 @@ public void saveCompositionFile(SampleBean sampleBean, FileBean fileBean) throw new CompositionException(err, e); } } - - public ComposingElementBean findComposingElementByID(String composingElementId) throws CompositionException, NoAccessException { - ComposingElementBean ceBean = null; - try { - ComposingElement cElement = compositionServiceHelper.findComposingElementById(composingElementId); - if(cElement != null) { - ceBean = new ComposingElementBean(cElement); - } else { - throw new NoAccessException("User doesn't have access to the sample"); - } - }catch (NoAccessException e) { - throw e; - } catch (Exception e) { - String err = "Problem finding the composing element by id: " + composingElementId; - logger.error(err, e); - throw new CompositionException(err, e); - } - return ceBean; - } public FunctionalizingEntityBean findFunctionalizingEntityById(String sampleId, String entityId) throws CompositionException, NoAccessException { @@ -591,8 +571,6 @@ public boolean checkChemicalAssociationBeforeDelete(SampleComposition comp, Asso } return true; } - - public CompositionBean findCompositionBySampleId(String sampleId) throws CompositionException { CompositionBean comp = null; diff --git a/software/cananolab-webapp/web/scripts/controllers/sample/edit/editNanoMaterialEntity.js b/software/cananolab-webapp/web/scripts/controllers/sample/edit/editNanoMaterialEntity.js index 46fed510b8..68f37a5efc 100644 --- a/software/cananolab-webapp/web/scripts/controllers/sample/edit/editNanoMaterialEntity.js +++ b/software/cananolab-webapp/web/scripts/controllers/sample/edit/editNanoMaterialEntity.js @@ -305,23 +305,23 @@ var app = angular.module('angularApp') } $scope.nanoEntityForm.composingElements = $scope.composingElements; - // if( $scope.nanoEntityForm.simpleCompBean == null ) { - // $scope.nanoEntityForm.simpleCompBean = {}; - // } - // - // $scope.nanoEntityForm.simpleCompBean.id = $scope.composingElementForm.id; - // $scope.nanoEntityForm.simpleCompBean.type = $scope.composingElementForm.type; - // $scope.nanoEntityForm.simpleCompBean.name = $scope.composingElementForm.name; - // $scope.nanoEntityForm.simpleCompBean.pubChemDataSourceName = $scope.composingElementForm.pubChemDataSourceName; - // $scope.nanoEntityForm.simpleCompBean.pubChemId = $scope.composingElementForm.pubChemId; - // $scope.nanoEntityForm.simpleCompBean.value = $scope.composingElementForm.value; - // $scope.nanoEntityForm.simpleCompBean.valueUnit = $scope.composingElementForm.valueUnit; - // $scope.nanoEntityForm.simpleCompBean.molecularFormulaType = $scope.composingElementForm.molecularFormulaType; - // $scope.nanoEntityForm.simpleCompBean.molecularFormula = $scope.composingElementForm.molecularFormula; - // $scope.nanoEntityForm.simpleCompBean.description = $scope.composingElementForm.description; - // $scope.nanoEntityForm.simpleCompBean.inherentFunction = $scope.composingElementForm.inherentFunction; - // $scope.nanoEntityForm.simpleCompBean.createdBy = $scope.composingElementForm.createdBy; - // $scope.nanoEntityForm.simpleCompBean.createdDate = $scope.composingElementForm.createdDate; + if( $scope.nanoEntityForm.simpleCompBean == null ) { + $scope.nanoEntityForm.simpleCompBean = {}; + } + + $scope.nanoEntityForm.simpleCompBean.id = $scope.composingElementForm.id; + $scope.nanoEntityForm.simpleCompBean.type = $scope.composingElementForm.type; + $scope.nanoEntityForm.simpleCompBean.name = $scope.composingElementForm.name; + $scope.nanoEntityForm.simpleCompBean.pubChemDataSourceName = $scope.composingElementForm.pubChemDataSourceName; + $scope.nanoEntityForm.simpleCompBean.pubChemId = $scope.composingElementForm.pubChemId; + $scope.nanoEntityForm.simpleCompBean.value = $scope.composingElementForm.value; + $scope.nanoEntityForm.simpleCompBean.valueUnit = $scope.composingElementForm.valueUnit; + $scope.nanoEntityForm.simpleCompBean.molecularFormulaType = $scope.composingElementForm.molecularFormulaType; + $scope.nanoEntityForm.simpleCompBean.molecularFormula = $scope.composingElementForm.molecularFormula; + $scope.nanoEntityForm.simpleCompBean.description = $scope.composingElementForm.description; + $scope.nanoEntityForm.simpleCompBean.inherentFunction = $scope.composingElementForm.inherentFunction; + $scope.nanoEntityForm.simpleCompBean.createdBy = $scope.composingElementForm.createdBy; + $scope.nanoEntityForm.simpleCompBean.createdDate = $scope.composingElementForm.createdDate; if( $scope.sampleId != null ) { @@ -329,7 +329,7 @@ var app = angular.module('angularApp') } - $http({method: 'POST', url: '/caNanoLab/rest/nanomaterialEntity/removeComposingElement?id='+ composingElementId ,data: $scope.nanoEntityForm}). + $http({method: 'POST', url: '/caNanoLab/rest/nanomaterialEntity/removeComposingElement',data: $scope.nanoEntityForm}). success(function(data, status, headers, config) { $scope.nanoEntityForm = data; $scope.composingElements = $scope.nanoEntityForm.composingElements; @@ -366,23 +366,23 @@ var app = angular.module('angularApp') $scope.nanoEntityForm.composingElements = $scope.composingElements; - // if( $scope.nanoEntityForm.simpleCompBean == null ) { - // $scope.nanoEntityForm.simpleCompBean = {}; - // } - // - // $scope.nanoEntityForm.simpleCompBean.id = $scope.composingElementForm.id; - // $scope.nanoEntityForm.simpleCompBean.type = $scope.composingElementForm.type; - // $scope.nanoEntityForm.simpleCompBean.name = $scope.composingElementForm.name; - // $scope.nanoEntityForm.simpleCompBean.pubChemDataSourceName = $scope.composingElementForm.pubChemDataSourceName; - // $scope.nanoEntityForm.simpleCompBean.pubChemId = $scope.composingElementForm.pubChemId; - // $scope.nanoEntityForm.simpleCompBean.value = $scope.composingElementForm.value; - // $scope.nanoEntityForm.simpleCompBean.valueUnit = $scope.composingElementForm.valueUnit; - // $scope.nanoEntityForm.simpleCompBean.molecularFormulaType = $scope.composingElementForm.molecularFormulaType; - // $scope.nanoEntityForm.simpleCompBean.molecularFormula = $scope.composingElementForm.molecularFormula; - // $scope.nanoEntityForm.simpleCompBean.description = $scope.composingElementForm.description; - // $scope.nanoEntityForm.simpleCompBean.inherentFunction = $scope.composingElementForm.inherentFunction; - // $scope.nanoEntityForm.simpleCompBean.createdBy = $scope.composingElementForm.createdBy; - // $scope.nanoEntityForm.simpleCompBean.createdDate = $scope.composingElementForm.createdDate; + if( $scope.nanoEntityForm.simpleCompBean == null ) { + $scope.nanoEntityForm.simpleCompBean = {}; + } + + $scope.nanoEntityForm.simpleCompBean.id = $scope.composingElementForm.id; + $scope.nanoEntityForm.simpleCompBean.type = $scope.composingElementForm.type; + $scope.nanoEntityForm.simpleCompBean.name = $scope.composingElementForm.name; + $scope.nanoEntityForm.simpleCompBean.pubChemDataSourceName = $scope.composingElementForm.pubChemDataSourceName; + $scope.nanoEntityForm.simpleCompBean.pubChemId = $scope.composingElementForm.pubChemId; + $scope.nanoEntityForm.simpleCompBean.value = $scope.composingElementForm.value; + $scope.nanoEntityForm.simpleCompBean.valueUnit = $scope.composingElementForm.valueUnit; + $scope.nanoEntityForm.simpleCompBean.molecularFormulaType = $scope.composingElementForm.molecularFormulaType; + $scope.nanoEntityForm.simpleCompBean.molecularFormula = $scope.composingElementForm.molecularFormula; + $scope.nanoEntityForm.simpleCompBean.description = $scope.composingElementForm.description; + $scope.nanoEntityForm.simpleCompBean.inherentFunction = $scope.composingElementForm.inherentFunction; + $scope.nanoEntityForm.simpleCompBean.createdBy = $scope.composingElementForm.createdBy; + $scope.nanoEntityForm.simpleCompBean.createdDate = $scope.composingElementForm.createdDate; if( $scope.sampleId != null ) { $scope.nanoEntityForm.sampleId = $scope.sampleId;