Skip to content

Commit

Permalink
Merge pull request #1048 from usnistgov/pre-deploy
Browse files Browse the repository at this point in the history
Pre deployment fixes
  • Loading branch information
Abdelghani90 authored Jul 22, 2020
2 parents aa7b2e0 + c9b397d commit 4847ae3
Show file tree
Hide file tree
Showing 27 changed files with 1,003 additions and 663 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.stereotype.Service;

import gov.nist.diff.domain.DeltaAction;
import gov.nist.diff.domain.DeltaMode;
import gov.nist.hit.hl7.igamt.coconstraints.exception.CoConstraintGroupNotFoundException;
import gov.nist.hit.hl7.igamt.coconstraints.model.CoConstraint;
import gov.nist.hit.hl7.igamt.coconstraints.model.CoConstraintBinding;
Expand All @@ -30,7 +29,6 @@
import gov.nist.hit.hl7.igamt.common.base.domain.DocumentStructureDataModel;
import gov.nist.hit.hl7.igamt.common.base.domain.Link;
import gov.nist.hit.hl7.igamt.common.base.domain.MsgStructElement;
import gov.nist.hit.hl7.igamt.common.base.domain.Type;
import gov.nist.hit.hl7.igamt.common.base.domain.ValuesetBinding;
import gov.nist.hit.hl7.igamt.common.base.domain.display.DisplayElement;
import gov.nist.hit.hl7.igamt.common.binding.domain.ResourceBinding;
Expand All @@ -47,7 +45,6 @@
import gov.nist.hit.hl7.igamt.delta.exception.IGDeltaException;
import gov.nist.hit.hl7.igamt.delta.service.DeltaService;
import gov.nist.hit.hl7.igamt.display.model.IGDisplayInfo;
import gov.nist.hit.hl7.igamt.export.configuration.domain.DeltaConfiguration;
import gov.nist.hit.hl7.igamt.export.configuration.domain.ExportConfiguration;
import gov.nist.hit.hl7.igamt.export.configuration.domain.ExportFontConfiguration;
import gov.nist.hit.hl7.igamt.export.configuration.newModel.ExportFilterDecision;
Expand Down Expand Up @@ -202,9 +199,8 @@ public ExportFilterDecision getExportFilterDecision(DocumentStructure documentSt
} else {
processConformanceProfiles(ig, decision, config);
}

return decision;
}else if(documentStructure instanceof DatatypeLibrary) {
} else if(documentStructure instanceof DatatypeLibrary) {
DatatypeLibrary datatypeLibrary = (DatatypeLibrary) documentStructure;
for (Link l : datatypeLibrary.getDatatypeRegistry().getChildren()) {
Datatype dt = datatypeService.findById(l.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
*/
package gov.nist.hit.hl7.igamt.display.model;

import gov.nist.hit.hl7.igamt.ig.domain.IgTemplate;

/**
* @author Abdelghani El Ouakili
*
*/
public class CopyInfo {

private CloneMode mode;
private Object data;

private IgTemplate template;
private boolean inherit;


public CopyInfo() {
super();
// TODO Auto-generated constructor stub
Expand All @@ -31,11 +35,20 @@ public CloneMode getMode() {
public void setMode(CloneMode mode) {
this.mode = mode;
}
public Object getData() {
return data;

public IgTemplate getTemplate() {
return template;
}

public void setTemplate(IgTemplate template) {
this.template = template;
}
public boolean isInherit() {
return inherit;
}
public void setData(Object data) {
this.data = data;

public void setInherit(boolean inherit) {
this.inherit = inherit;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import gov.nist.hit.hl7.igamt.ig.controller.wrappers.ReqId;
import gov.nist.hit.hl7.igamt.ig.domain.Ig;
import gov.nist.hit.hl7.igamt.ig.domain.IgDocumentConformanceStatement;
import gov.nist.hit.hl7.igamt.ig.domain.IgTemplate;
import gov.nist.hit.hl7.igamt.ig.domain.datamodel.IgDataModel;
import gov.nist.hit.hl7.igamt.ig.domain.verification.ComplianceReport;
import gov.nist.hit.hl7.igamt.ig.domain.verification.VerificationReport;
Expand All @@ -114,6 +115,7 @@
import gov.nist.hit.hl7.igamt.ig.model.AddValueSetResponseObject;
import gov.nist.hit.hl7.igamt.ig.model.IGDisplay;
import gov.nist.hit.hl7.igamt.ig.model.TreeNode;
import gov.nist.hit.hl7.igamt.ig.repository.IgTemplateRepository;
import gov.nist.hit.hl7.igamt.ig.service.CrudService;
import gov.nist.hit.hl7.igamt.ig.service.DisplayConverterService;
import gov.nist.hit.hl7.igamt.ig.service.IgService;
Expand Down Expand Up @@ -187,6 +189,9 @@ public class IGDocumentController extends BaseController {

@Autowired
private FhirHandlerService fhirHandlerService;

@Autowired
private IgTemplateRepository igTemplateRepository;


private static final String DATATYPE_DELETED = "DATATYPE_DELETED";
Expand Down Expand Up @@ -1801,4 +1806,13 @@ private void visitDatatype(Set<Component> components, Ig selectedIg, Ig all) {
}
});
}

@RequestMapping(value = "/api/igdocuments/igTemplates", method = RequestMethod.GET, produces = { "application/json" })
public @ResponseBody List<IgTemplate> igTemplates( Authentication authentication) throws Exception {

List<IgTemplate> templates = this.igTemplateRepository.findAll();

return templates;
}

}
62 changes: 62 additions & 0 deletions ig/src/main/java/gov/nist/hit/hl7/igamt/ig/domain/IgTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* This software was developed at the National Institute of Standards and Technology by employees of
* the Federal Government in the course of their official duties. Pursuant to title 17 Section 105
* of the United States Code this software is not subject to copyright protection and is in the
* public domain. This is an experimental system. NIST assumes no responsibility whatsoever for its
* use by other parties, and makes no guarantees, expressed or implied, about its quality,
* reliability, or any other characteristic. We would appreciate acknowledgement if the software is
* used. This software can be redistributed and/or modified freely provided that any derivative
* works bear some notice that they are derived from it, and any modified versions bear some notice
* that they have been modified.
*/
package gov.nist.hit.hl7.igamt.ig.domain;

import java.util.List;
import java.util.Set;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import gov.nist.hit.hl7.igamt.ig.util.SectionTemplate;

/**
* @author Abdelghani El Ouakili
*
*/
@Document
public class IgTemplate {

@Id
private String id;
private String name;
private String domain;
private List<SectionTemplate> children;

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public List<SectionTemplate> getChildren() {
return children;
}
public void setChildren(List<SectionTemplate> children) {
this.children = children;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This software was developed at the National Institute of Standards and Technology by employees of
* the Federal Government in the course of their official duties. Pursuant to title 17 Section 105
* of the United States Code this software is not subject to copyright protection and is in the
* public domain. This is an experimental system. NIST assumes no responsibility whatsoever for its
* use by other parties, and makes no guarantees, expressed or implied, about its quality,
* reliability, or any other characteristic. We would appreciate acknowledgement if the software is
* used. This software can be redistributed and/or modified freely provided that any derivative
* works bear some notice that they are derived from it, and any modified versions bear some notice
* that they have been modified.
*/
package gov.nist.hit.hl7.igamt.ig.repository;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import gov.nist.hit.hl7.igamt.ig.domain.IgTemplate;

/**
* @author Abdelghani El Ouakili
*
*/

@Repository("igTemplateRepository")
public interface IgTemplateRepository extends MongoRepository<IgTemplate, String> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

import java.util.Set;

import javax.persistence.Id;

import org.springframework.data.mongodb.core.mapping.Document;

public class SectionTemplate {



private String label;
private String type;
private int position;
Expand All @@ -26,7 +31,6 @@ public SectionTemplate() {
}



public int getPosition() {
return position;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public Ig createEmptyIg()
emptyIg.setContent(content);
return emptyIg;
}


private TextSection createSectionContent(SectionTemplate template) {
// TODO Auto-generated method stub
Expand Down Expand Up @@ -450,7 +451,6 @@ public Ig clone(Ig ig, String username, CopyInfo info) {
newIg.setFrom(ig.getId());
newIg.setOrigin(ig.getId());
newIg.setMetadata(ig.getMetadata().clone());
newIg.setContent(ig.getContent());
newIg.setUsername(username);
newIg.setDomainInfo(ig.getDomainInfo());
newIg.getDomainInfo().setScope(Scope.USER);
Expand All @@ -469,14 +469,30 @@ public Ig clone(Ig ig, String username, CopyInfo info) {
newIg.setCoConstraintGroupRegistry(
copyCoConstraintGRoupRegistry(ig.getCoConstraintGroupRegistry(), newKeys, username, newIg.getId())
);


newIg.getDomainInfo().setScope(Scope.USER);
if(info.getMode().equals(CloneMode.CLONE)) {
newIg.getMetadata().setTitle(newIg.getMetadata().getTitle() + "[clone]");
newIg.setContent(ig.getContent());

}else if(info.getMode().equals(CloneMode.DERIVE)){
newIg.getMetadata().setTitle(newIg.getMetadata().getTitle() + "[derived]");
newIg.setDerived(true);
if(info.isInherit()) {
newIg.setContent(ig.getContent());
}else {
Set<TextSection> content = new HashSet<TextSection>();
if(info.getTemplate() !=null && info.getTemplate().getChildren() !=null) {
for (SectionTemplate template : info.getTemplate().getChildren()) {

content.add(createSectionContent(template));
}
newIg.setContent(content);
}else {
newIg.setContent(ig.getContent());

}
}

}
newIg.setCreationDate(new Date());

Expand Down Expand Up @@ -1335,4 +1351,5 @@ public void updateSharedUser(String id, SharedUsersInfo sharedUsersInfo) {
this.save(ig);
}
}

}
Loading

0 comments on commit 4847ae3

Please sign in to comment.