no message

This commit is contained in:
Ioannis Kalyvas 2018-03-01 11:14:10 +02:00
parent 1715e8629f
commit 52bceed971
40 changed files with 378 additions and 42 deletions

View File

@ -185,6 +185,19 @@
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
@ -247,6 +260,12 @@
<scope>provided</scope>
</dependency>
</dependencies>
<activation>
<property>
<name>profile</name>
<value>production</value>
</property>
</activation>
</profile>
</profiles>
</project>

View File

@ -13,11 +13,17 @@ import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
@ -81,4 +87,22 @@ public class DatasetWizardController extends BaseController {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.entities.Dataset>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/getWordDocument/{id}"}, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody
ResponseEntity<InputStreamResource> getWordDocument(@PathVariable String id) {
try {
File file = new DatasetManager().getWordDocument(this.getApiContext().getDatabaseRepository().getDatasetDao(), id);
InputStreamResource resource = new InputStreamResource(new FileInputStream(file));
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION,
"attachment;filename=" + file.getName())
.contentType(MediaType.APPLICATION_PDF).contentLength(file.length())
.body(resource);
} catch (Exception ex) {
ex.printStackTrace();
return new ResponseEntity<InputStreamResource>(HttpStatus.BAD_REQUEST);
}
}
}

View File

@ -0,0 +1,41 @@
package eu.eudat.documents.types;
/**
* Created by ikalyvas on 2/26/2018.
*/
public enum ParagraphStyle {
TEXT(0), HEADER1(1), HEADER2(2), HEADER3(3), HEADER4(4), TITLE(5), FOOTER(6), COMMENT(7);
private Integer value;
private ParagraphStyle(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
public static ParagraphStyle fromInteger(Integer value) {
switch (value) {
case 0:
return TEXT;
case 1:
return HEADER1;
case 2:
return HEADER2;
case 3:
return HEADER3;
case 4:
return HEADER4;
case 5:
return TITLE;
case 6:
return FOOTER;
case 7:
return COMMENT;
default:
throw new RuntimeException("Unsupported ParagraphStyle Code");
}
}
}

View File

@ -0,0 +1,31 @@
package eu.eudat.documents.types;
/**
* Created by ikalyvas on 2/27/2018.
*/
public enum TextStyle {
ITALIC(0), BOLD(1), CAPS(2);
private Integer value;
private TextStyle(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
public static TextStyle fromInteger(Integer value) {
switch (value) {
case 0:
return ITALIC;
case 1:
return BOLD;
case 2:
return CAPS;
default:
throw new RuntimeException("Unsupported TextStyle Code");
}
}
}

View File

@ -0,0 +1,193 @@
package eu.eudat.documents.word;
import eu.eudat.documents.types.ParagraphStyle;
import eu.eudat.documents.types.TextStyle;
import eu.eudat.models.user.components.datasetprofile.Field;
import eu.eudat.models.user.components.datasetprofile.FieldSet;
import eu.eudat.models.user.components.datasetprofile.Section;
import eu.eudat.models.user.composite.DatasetProfilePage;
import eu.eudat.models.user.composite.PagedDatasetProfile;
import eu.eudat.utilities.interfaces.Applier;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by ikalyvas on 2/26/2018.
*/
public class WordBuilder {
private Map<ParagraphStyle, Applier<XWPFDocument, String, XWPFParagraph>> options = new HashMap<>();
private CTAbstractNum cTAbstractNum;
private BigInteger numId;
public WordBuilder() {
this.cTAbstractNum = CTAbstractNum.Factory.newInstance();
this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(1));
}
private void buildOptions() {
this.options.put(ParagraphStyle.TEXT, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setFontSize(11);
return paragraph;
});
this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setBold(true);
run.setFontSize(14);
return paragraph;
});
this.options.put(ParagraphStyle.HEADER1, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setBold(true);
run.setFontSize(12);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph;
});
this.options.put(ParagraphStyle.HEADER2, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setBold(true);
run.setFontSize(12);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph;
});
this.options.put(ParagraphStyle.HEADER3, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setBold(true);
run.setFontSize(11);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph;
});
this.options.put(ParagraphStyle.FOOTER, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
return paragraph;
});
}
public File build(PagedDatasetProfile pagedDatasetProfile) throws IOException {
XWPFDocument document = new XWPFDocument();
this.buildOptions();
createPages(pagedDatasetProfile.getPages(), document, true);
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
XWPFNumbering numbering = document.createNumbering();
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
this.numId = numbering.addNum(abstractNumID);
createPages(pagedDatasetProfile.getPages(), document, false);
File exportFile = new File("welcome.docx");
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
return exportFile;
}
public void createPages(List<DatasetProfilePage> datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing) {
//if (createListing) this.addListing(mainDocumentPart, 0, false, true);
datasetProfilePages.forEach(item -> {
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.TITLE, 0, createListing);
});
}
public void createSections(List<Section> sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing) {
if (createListing) this.addListing(mainDocumentPart, indent, false, true);
BigInteger listing = numId;
sections.forEach(section -> {
if (!createListing) {
XWPFParagraph paragraph = addParagraphContent(section.getTitle(), mainDocumentPart, style, listing);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
}
createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER2, 1, createListing);
createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing);
});
}
public void createCompositeFields(List<FieldSet> compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing) {
if (createListing) this.addListing(mainDocumentPart, indent, true, true);
compositeFields.forEach(compositeField -> {
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
XWPFParagraph paragraph = addParagraphContent(compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER3, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
}
createFields(compositeField.getFields(), mainDocumentPart, 3, createListing);
});
}
public void createFields(List<Field> fields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing) {
if (createListing) this.addListing(mainDocumentPart, indent, false, false);
fields.forEach(field -> {
if (!createListing) {
XWPFParagraph paragraph = addParagraphContent(field.getValue(), mainDocumentPart, ParagraphStyle.TEXT, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
}
});
}
public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
if (numId != null) paragraph.setNumID(numId);
return paragraph;
}
public void addStyling(List<TextStyle> styles, String color) {
}
public void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) {
//this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(indent));
CTLvl cTLvl = this.cTAbstractNum.addNewLvl();
String textLevel = "";
for (int i = 0; i <= indent; i++) {
textLevel += "%" + (i + 1) + ".";
}
if (question) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal("Q " + textLevel);
cTLvl.addNewStart().setVal(BigInteger.valueOf(1));
} else if (!question && hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal(textLevel);
cTLvl.addNewStart().setVal(BigInteger.valueOf(1));
}
if (!question && !hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE);
}
/*if (this.numId == null) {
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
XWPFNumbering numbering = document.createNumbering();
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
this.numId = numbering.addNum(abstractNumID);
}*/
}
}

View File

@ -1,6 +1,6 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.utilities.DatabaseDefinition;
import eu.eudat.utilities.interfaces.DatabaseDefinition;
public interface DatabaseViewStyleDefinition extends DatabaseDefinition {

View File

@ -4,7 +4,7 @@ import eu.eudat.models.components.commons.DefaultValue;
import eu.eudat.models.components.commons.ViewStyle;
import eu.eudat.models.components.commons.Visibility;
import eu.eudat.models.components.commons.datafield.FieldData;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import eu.eudat.utilities.builders.ModelBuilder;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;

View File

@ -1,7 +1,7 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.models.components.commons.Multiplicity;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.entities.xmlmodels.modeldefinition;
import eu.eudat.utilities.DatabaseDefinition;
import eu.eudat.utilities.interfaces.DatabaseDefinition;
public interface DatabaseModelDefinition extends DatabaseDefinition {

View File

@ -2,6 +2,7 @@ package eu.eudat.managers;
import eu.eudat.builders.entity.UserInfoBuilder;
import eu.eudat.dao.entities.*;
import eu.eudat.documents.word.WordBuilder;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.criteria.DataRepositoryCriteria;
@ -18,6 +19,9 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.services.ApiContext;
import org.json.JSONObject;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -50,6 +54,12 @@ public class DatasetManager {
public DatasetWizardModel getSingle(DatasetDao datatasetRepository, String id) throws InstantiationException, IllegalAccessException {
DatasetWizardModel dataset = new DatasetWizardModel();
eu.eudat.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity));
dataset.fromDataModel(datasetEntity);
return dataset;
}
private PagedDatasetProfile getPagedProfile(DatasetWizardModel dataset, eu.eudat.entities.Dataset datasetEntity) {
eu.eudat.models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(datasetEntity.getProfile());
datasetprofile.setStatus(dataset.getStatus());
if (datasetEntity.getProperties() != null) {
@ -59,9 +69,15 @@ public class DatasetManager {
}
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
dataset.setDatasetProfileDefinition(pagedDatasetProfile);
dataset.fromDataModel(datasetEntity);
return dataset;
return pagedDatasetProfile;
}
public File getWordDocument(DatasetDao datatasetRepository, String id) throws InstantiationException, IllegalAccessException, IOException {
WordBuilder wordBuilder = new WordBuilder();
DatasetWizardModel dataset = new DatasetWizardModel();
eu.eudat.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset,datasetEntity);
return wordBuilder.build(pagedDatasetProfile);
}
public static eu.eudat.entities.Dataset createOrUpdate(ApiContext apiContext, DatasetWizardModel profile, Principal principal) throws Exception {

View File

@ -3,7 +3,7 @@ package eu.eudat.models.admin.components.datasetprofile;
import eu.eudat.models.components.commons.DefaultValue;
import eu.eudat.models.components.commons.ViewStyle;
import eu.eudat.models.components.commons.Visibility;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import org.apache.commons.lang3.RandomStringUtils;

View File

@ -1,7 +1,7 @@
package eu.eudat.models.admin.components.datasetprofile;
import eu.eudat.models.components.commons.Multiplicity;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import org.apache.commons.lang3.RandomStringUtils;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.admin.components.datasetprofile;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
public class Page implements Comparable, ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page> {

View File

@ -1,6 +1,6 @@
package eu.eudat.models.admin.components.datasetprofile;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import org.apache.commons.lang3.RandomStringUtils;

View File

@ -1,7 +1,7 @@
package eu.eudat.models.components.commons;
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.components.commons;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.components.commons.datafield;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.components.commons.datafield;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.components.commons.datafield;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

View File

@ -1,6 +1,6 @@
package eu.eudat.models.dmp;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -6,7 +6,7 @@ import eu.eudat.models.components.commons.ViewStyle;
import eu.eudat.models.components.commons.Visibility;
import eu.eudat.models.properties.PropertiesGenerator;
import eu.eudat.models.user.composite.PropertiesModelBuilder;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import java.util.LinkedList;

View File

@ -3,7 +3,7 @@ package eu.eudat.models.user.components.datasetprofile;
import eu.eudat.models.components.commons.Multiplicity;
import eu.eudat.models.properties.PropertiesGenerator;
import eu.eudat.models.user.composite.PropertiesModelBuilder;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import java.util.*;

View File

@ -2,7 +2,7 @@ package eu.eudat.models.user.components.datasetprofile;
import eu.eudat.models.properties.PropertiesGenerator;
import eu.eudat.models.user.composite.PropertiesModelBuilder;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import eu.eudat.utilities.builders.ModelBuilder;
import java.util.Collections;

View File

@ -3,8 +3,8 @@ package eu.eudat.utilities.builders;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
import eu.eudat.models.components.commons.datafield.*;
import eu.eudat.utilities.ModelDefinition;
import eu.eudat.utilities.ViewStyleDefinition;
import eu.eudat.utilities.interfaces.ModelDefinition;
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
import org.w3c.dom.Element;
import java.util.LinkedList;

View File

@ -0,0 +1,8 @@
package eu.eudat.utilities.interfaces;
/**
* Created by ikalyvas on 2/27/2018.
*/
public interface Applier<A, V, R> {
R apply(A applier, V value);
}

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
/**
* Created by ikalyvas on 2/5/2018.

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
public interface DatabaseDefinition {

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;

View File

@ -1,4 +1,4 @@
package eu.eudat.utilities;
package eu.eudat.utilities.interfaces;
import org.w3c.dom.Document;

View File

@ -51,8 +51,8 @@ autouser.root.email=root@dmp.com
autouser.root.password=root
autouser.root.username=root
#################################################################################
b2access.externallogin.user_info_url = https://unity.eudat-aai.fz-juelich.de:443/oauth2/userinfo
b2access.externallogin.access_token_url = https://unity.eudat-aai.fz-juelich.de:443/oauth2/token
b2access.externallogin.user_info_url = https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
b2access.externallogin.access_token_url = https://b2access-integration.fz-juelich.de:443/oauth2/token
b2access.externallogin.redirect_uri = http://dmp.eudat.org:4200/api/oauth/authorized/b2access
b2access.externallogin.clientid = eudatdmptool
b2access.externallogin.clientSecret = A3b*1*92

View File

@ -71,9 +71,9 @@ import { B2AccessLoginComponent } from './user-management/login/b2access/b2acces
b2accessConfiguration: {
clientId: "eudatdmptool",
clientSecret: "A3b*1*92",
oauthUrl: "https://unity.eudat-aai.fz-juelich.de/oauth2-as/oauth2-authz",
oauthUrl: "https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz",
redirectUri: "http://dmp.eudat.org:4200/api/oauth/authorized/b2access",
accessTokenUri: "https://unity.eudat-aai.fz-juelich.de:443/oauth2/token"
accessTokenUri: "https://b2access-integration.fz-juelich.de:443/oauth2/token"
}
}),
HttpModule,

View File

@ -7,6 +7,7 @@
title={{dashboardStatisticsData.totalProjectCount}}
headerIcon="list"
category="Projects"
[hasFootContent]="this.isAuthenticated()"
footContent="Open Projects"
routelLink= '/projects'
footerIcon="open_in_new"
@ -19,6 +20,7 @@
title={{dashboardStatisticsData.totalDataManagementPlanCount}}
headerIcon="mode_edit"
category="DMPs"
[hasFootContent]="this.isAuthenticated()"
footContent="Open DMPs"
routelLink= '/dmps'
footerIcon="open_in_new"
@ -31,6 +33,7 @@
title={{dashboardStatisticsData.totalDataSetCount}}
headerIcon="subject"
category="Datasets"
[hasFootContent]="this.isAuthenticated()"
footContent="Open Datasets"
routelLink= '/datasets'
footerIcon="open_in_new"

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { DashboardService } from '../../app/services/dashboard/dashboard.service';
import { DashboardStatisticsModel } from '../models/dashboard/DashboardStatisticsModel';
@ -30,22 +30,22 @@ export class HomepageComponent implements OnInit {
ngOnInit() {
if(!this.isAuthenticated()){
if (!this.isAuthenticated()) {
this.dashBoardService.getStatistics().subscribe(results => {
//let data = results['payload'];
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
})
}else{
} else {
this.dashBoardService.getStatisticsSpecificuser().subscribe(results => {
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
})
}
}
public isAuthenticated(): boolean {
return !(!this.authentication.current())
}
return !(!this.authentication.current())
}
}

View File

@ -6,7 +6,7 @@
<p class="category">{{ category }}</p>
<h3 class="title">{{ title }}</h3>
</div>
<div class="card-footer">
<div *ngIf="hasFootContent" class="card-footer">
<a style="cursor:pointer;" (click)= "navigateToUrl()"><i class="material-icons text-danger">{{ footerIcon }}</i> {{ footContent }}</a>
</div>
</div>

View File

@ -15,6 +15,7 @@ export class FigurecardComponent implements OnInit {
@Input() linearColor: string;
@Input() boxShadow: string;
@Input() routelLink: string;
@Input() hasFootContent = true;
constructor(private router:Router) { }