Skip to content

Commit

Permalink
Merge pull request #313 from ec-jrc/develop
Browse files Browse the repository at this point in the history
Re3gistry2 2.5.1 release
  • Loading branch information
unaibrrgn authored Sep 29, 2023
2 parents 81dbcea + 3549569 commit 5ae2d4d
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 68 deletions.
7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/re3gistry-discussion.md

This file was deleted.

30 changes: 0 additions & 30 deletions .github/ISSUE_TEMPLATE/re3gistry-improvement-proposal.md

This file was deleted.

25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/re3gistry-problem.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
application.persistenceunitname=Re3gistry2

# Application version
application.version=Version: 2.4.2
application.version=Version: 2.5.1

# Localization
application.language.available=en
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
request.setCharacterEncoding("UTF-8");
%>

<link rel="stylesheet" href="res/css/css-loader.css">
<ol class="breadcrumb m-0 p-0" vocab="http://schema.org/" typeof="BreadcrumbList" style="font-size: 1.0em; font-weight: 700">

<% if (!registryURI.isEmpty() && !registryLabel.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="ecl-container ecl-footer-standardised__container">
<section class="ecl-footer-core__section ecl-footer-core__section1">
<a href="https://github.com/ec-jrc/re3gistry/releases"
class="ecl-footer-core__title ecl-link ecl-link--standalone">Re3gistry version 2.4.2</a>
class="ecl-footer-core__title ecl-link ecl-link--standalone">Re3gistry version 2.5.1</a>
<div class="ecl-footer-core__description"><a data-i18n-link="l-ec-website" class="ecl-link ecl-link--standalone"
href="https://inspire-sandbox.jrc.ec.europa.eu/registry"
aria-label="European Commission">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ private void storeItems(HashMap<String, ArrayList<FieldsBulkImport>> itemsBulkIm
RegItemclass regItemclassChild = getItemClassChildren(regItemContainer);

if (regItemclassChild != null) {
RegAction regAction = new RegAction();
RegAction regAction = addRegActionForAllProposedItemsCSV(regUser, regItemContainer, regItemclassChild);
if (regAction != null) {
storeProposedItems(itemsBulkImport, regItemContainer, regUser, regItemclassChild, regAction, request, additionLines);
try {
Expand Down Expand Up @@ -1251,7 +1251,8 @@ private void storeProposedItems(HashMap<String, ArrayList<FieldsBulkImport>> ite
items.getValue().get(0).getRegFieldsHashMap().values();
HashMap<RegField, String> fields = items.getValue().get(0).getRegFieldsHashMap();
RegItem regItemIterator = regItemManager.getByLocalidAndRegItemClass(items.getKey(), regItemclassChild);
regItemproposedHandler.completeCopyRegItemToRegItemporposedBulkEdit(regItemIterator, regUser, fields);
String language = items.getValue().get(0).getLanguage().getUuid();
regItemproposedHandler.completeCopyRegItemToRegItemporposedBulkEdit(regItemIterator, regUser, fields, additionLines, language);
}
} catch (Exception ex) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,92 @@ private void copyRegRelationsToRegRelationproposeds(RegItem regItem, RegItemprop
regLocalizationproposedManager.add(regLocalizationproposed);
}
}
private void copyRegRelationsToRegRelationproposedsBulkEdit(RegItem regItem, RegItemproposed regItemproposed, HashMap<RegField, String> fields, ArrayList<String> additionLines, String language) throws Exception {
RegRelationManager regRelationManager = new RegRelationManager(entityManager);
RegLocalizationManager regLocalizationManager = new RegLocalizationManager(entityManager);
RegRelationproposedManager regRelationproposedManager = new RegRelationproposedManager(entityManager);
RegLocalizationproposedManager regLocalizationproposedManager = new RegLocalizationproposedManager(entityManager);
RegItemManager regItemManager = new RegItemManager(entityManager);
RegItemclassManager regItemclassManager = new RegItemclassManager(entityManager);
try {

regItemManager.getByLocalid(language);
// Getting all the relations related to that object
List<RegRelation> regRelations = regRelationManager.getAllBySubject(regItem);

// Copying RegRelations to RegRelationProposeds
HashMap<String, RegRelationproposed> tempHashmap = new HashMap();

for (int j = 0; j < regRelations.size(); j++) {
List<RegLocalization> localizations = regRelations.get(j).getRegLocalizationList();
RegItem regItemCurrent = regRelations.get(j).getRegItemObject();
RegItem regItemObject = new RegItem();
for (Map.Entry<RegField, String> entry : fields.entrySet()) {
for (int i = 0; i < localizations.size(); i++) {
if (localizations.get(i).getRegField().getLocalid().equalsIgnoreCase(entry.getKey().getLocalid())) {
if(!entry.getValue().equalsIgnoreCase("")){
RegItemclass regItemClassObject = regItemclassManager.getByLocalid(entry.getKey().getLocalid());
regItemObject = regItemManager.getByLocalidAndRegItemClass(entry.getValue(), regItemClassObject);
regRelations.get(j).setRegItemObject(regItemCurrent);
}

}

}
}

if (regItemObject.getUuid() == null){
regItemObject = regItemCurrent;
}

RegRelationproposed regRelationproposed = new RegRelationproposed();
String regRelationproposedUuid = RegRelationproposedUuidHelper.getUuid(regItemproposed, null, regRelations.get(j).getRegRelationpredicate(), null, regItemCurrent);
//String regRelationproposedUuid2 = RegRelationproposedUuidHelper.getUuid(regItemproposed, null, regRelations.get(j).getRegRelationpredicate(), null, regRelations.get(j).getRegItemObject());

regRelationproposed.setUuid(regRelationproposedUuid);
regRelationproposed.setRegItemSubject(null);
regRelationproposed.setRegItemproposedSubject(regItemproposed);
regRelationproposed.setRegItemObject(regItemObject);
regRelationproposed.setRegItemproposedObject(null);
regRelationproposed.setRegRelationReference(regRelations.get(j));
regRelationproposed.setRegRelationpredicate(regRelations.get(j).getRegRelationpredicate());
regRelationproposed.setInsertdate(new Date());

regRelationproposedManager.add(regRelationproposed);

tempHashmap.put(regRelations.get(j).getUuid(), regRelationproposed);

}

// Replicating the relevant Reglocalizationproposeds pointing to the
// RegRelationproposed copyied above
// Getting all the localization with a reference to a reg relation
// related to the current RegItem
List<RegLocalization> regLocalizations = regLocalizationManager.getAllWithRelationReference(regItem);
for (RegLocalization regLocalization : regLocalizations) {
// Creating the regLocalizationproposed for the regRelationreference

RegLocalizationproposed regLocalizationproposed = new RegLocalizationproposed();
String newUuid = RegLocalizationproposedUuidHelper.getUuid(regLocalization.getFieldValueIndex(), regLocalization.getRegLanguagecode(), regItemproposed, regLocalization.getRegField());
regLocalizationproposed.setUuid(newUuid);
regLocalizationproposed.setFieldValueIndex(regLocalization.getFieldValueIndex());
regLocalizationproposed.setHref(regLocalization.getHref());
regLocalizationproposed.setRegField(regLocalization.getRegField());
regLocalizationproposed.setRegItemproposed(regItemproposed);
regLocalizationproposed.setRegLanguagecode(regLocalization.getRegLanguagecode());
regLocalizationproposed.setRegLocalizationReference(regLocalization);
regLocalizationproposed.setRegRelationproposedReference(tempHashmap.get(regLocalization.getRegRelationReference().getUuid()));
regLocalizationproposed.setValue(regLocalization.getValue());
regLocalizationproposed.setInsertdate(new Date());
regLocalizationproposed.setRegAction(regItemproposed.getRegAction());

regLocalizationproposedManager.add(regLocalizationproposed);
}

} catch (Exception e) {
System.out.println("eu.europa.ec.re3gistry2.javaapi.handler.RegItemproposedHandler.copyRegRelationsToRegRelationproposedsBulkEdit()");
}
}

// Copy all the RegItemRegGroupRegRoleMapping related to the item passed by parameter
// to RegItemproposedRegGroupRegRoleMapping
Expand Down Expand Up @@ -2002,7 +2088,7 @@ public RegItemproposed completeCopyRegItemToRegItemporposed(RegItem regItem, Reg
return regItemproposed;
}

public RegItemproposed completeCopyRegItemToRegItemporposedBulkEdit(RegItem regItem, RegUser regUser, HashMap<RegField, String> fields) throws Exception {
public RegItemproposed completeCopyRegItemToRegItemporposedBulkEdit(RegItem regItem, RegUser regUser, HashMap<RegField, String> fields, ArrayList<String> additionLines, String language) throws Exception {
RegItemproposed regItemproposed = null;
synchronized (sync) {
if (!entityManager.getTransaction().isActive()) {
Expand All @@ -2023,7 +2109,7 @@ public RegItemproposed completeCopyRegItemToRegItemporposedBulkEdit(RegItem regI
entityManager.getTransaction().begin();
}
if (regItem != null && regItemproposed != null) {
copyRegRelationsToRegRelationproposeds(regItem, regItemproposed);
copyRegRelationsToRegRelationproposedsBulkEdit(regItem, regItemproposed, fields, additionLines, language);
}
entityManager.getTransaction().commit();

Expand Down

0 comments on commit 5ae2d4d

Please sign in to comment.