Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 7.2 #745

Merged
merged 44 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d9669d9
remove symbolic link
masumcse1 Apr 15, 2023
5a75f27
create parent pom
masumcse1 Apr 15, 2023
3241424
create parent & child pom
masumcse1 Apr 15, 2023
ac23203
create pom file.
masumcse1 Apr 15, 2023
47372a2
correction.
masumcse1 Apr 15, 2023
238ae3a
[FIX] Neo4j persistence only : case when node not found by uuid
ClementBareth Apr 25, 2023
50ab2bd
Use input stream to send response
ClementBareth Apr 27, 2023
5477e25
Remote encrypted Password set (#713)
masumcse1 Apr 28, 2023
afe3e29
fix #714 use dynamic columns
smichea May 8, 2023
71b60e9
Set current module to null while installing a module
ClementBareth May 9, 2023
a018737
update CustomRelationshipTemplate getCRTForCache named query
QuentinTixier May 10, 2023
90473af
fix #716
smichea May 19, 2023
e85b501
fix #717
smichea May 19, 2023
6c0a55c
fix side effect of #717 fix
smichea May 20, 2023
9f74412
refix #717
smichea May 20, 2023
12b55ee
fix #718
smichea May 20, 2023
3d0bb77
fix #719
smichea May 20, 2023
8ac7aa6
remove entity references in salt computation #719
smichea May 20, 2023
c6fc3c2
fix nullpointerexception issue when getting files from local meveo ma…
masumcse1 May 25, 2023
eba5933
Code revert for adding symbolic link in module (#721)
masumcse1 May 25, 2023
60ded98
Merge branch 'develop' into persistance_node
ClementBareth May 26, 2023
9abf140
Merge pull request #723 from meveo-org/persistance_node
ClementBareth May 26, 2023
2714d35
[FIX] Set up cet on entity ref create
ClementBareth May 26, 2023
6ec090a
include authentication in meveo maven github repo
smichea May 26, 2023
7c72188
Cache .m2 & compiled classes to speed up image building
ClementBareth Jun 1, 2023
614b638
Add default timeout setting
ClementBareth Jun 1, 2023
5ea5231
module pom update . (#725)
masumcse1 Jun 5, 2023
11dc936
resolved dependency issue from remote repo (#727)
masumcse1 Jun 5, 2023
3588cbb
module Clone Url correction (#729)
masumcse1 Jun 7, 2023
fad00a0
Retreive field with inheritance except for crt
Jun 8, 2023
f0238fe
UUID field max length increase for Sha512 (#732)
masumcse1 Jun 11, 2023
dce1014
remote push issue solved. (#734)
masumcse1 Jun 11, 2023
009ea05
Always check if child template is stored as table before deletion
ClementBareth Jun 21, 2023
54b1466
fix extractor import outputProperties and creation
Jun 9, 2023
f48d050
fix #736
smichea Jun 22, 2023
2d8888f
Merge branch 'develop' of github.com:meveo-org/meveo into develop
smichea Jun 22, 2023
b5a4dae
add bouncycastle dependency
smichea Jun 23, 2023
a9f4a8f
Grid column data loading when User a ref entity (#737)
masumcse1 Jun 26, 2023
0eebb52
upgrade maven
smichea Jun 26, 2023
fcd65f0
Add current user in EndpointScript params
QuentinTixier Jun 27, 2023
d861e74
also add current user in synchronous endpoint execution
QuentinTixier Jun 28, 2023
4079271
add doc for current user in endpoint params
QuentinTixier Jun 28, 2023
f52570a
fix #739 (#741)
masumcse1 Jul 19, 2023
3d5127c
fix #740 (#742)
masumcse1 Jul 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@ COPY . .
# Download all dependencies using docker cache
#RUN mvn dependency:go-offline

RUN mvn clean package -Dscm.url=${SCM} -DskipTests
RUN --mount=type=cache,target=/root/.m2 \
--mount=type=cache,target=/usr/src/meveo/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-admin-ejbs/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-admin-web/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-annotations/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-api/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-api-dto/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-el-resolver/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-json-schema/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-model/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-reporting/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-security/target/classes \
--mount=type=cache,target=/usr/src/meveo/meveo-ws/target/classes \
mvn package -Dscm.url=${SCM} -DskipTests -Dmaven.test.skip=true

##################################################################
##### Build meveo docker image #####
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ RUN apt-get update \
&& apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

# Install maven
ARG MAVEN_VERSION=3.6.3
ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
ARG MAVEN_VERSION=3.9.3
ARG SHA=400fc5b6d000c158d5ee7937543faa06b6bda8408caa2444a9c947c21472fde0f0b64ac452b8cec8855d528c0335522ed5b6c8f77085811c7e29e1bedbb5daa2
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
Expand Down
3 changes: 2 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ The following environment variables can be redefined for meveo service
|WILDFLY_LOG_FILE_LEVEL |INFO |Wildfly server log level (means server.log file) |
|WILDFLY_LOG_MEVEO_LEVEL |INFO |Meveo source log level |
|WILDFLY_DEBUG_ENABLE |"false" |Add a debug option to Wildfly startup command ("true" or "false"). debug_enable could not be used with `JAVA_OPTS` together. If this value is `true`, `JAVA_OPTS` should be commented.|
|WILDFLY_DEBUG_PORT |9999 |Wildfly debug port |
|WILDFLY_DEBUG_PORT |9999 |Wildfly debug port
|DEFAULT_TX_TIMEOUT |300 | Default EJB transaction timeout |
|JAVA_OPTS |Many parameters.<br/>Need to look at code|This variable can override default settings for wildfly java application. If this value is defined, WILDFLY_CUSTOM_XMS and WILDFLY_CUSTOM_XMX are ignored. |
|JAVA_EXTRA_OPTS |- |The extra options to add to the default jvm options. |### APM for Meveo wildfly

Expand Down
1 change: 1 addition & 0 deletions docker/configs/cli/standalone-configuration.cli
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ run-batch --file=/opt/jboss/wildfly/cli/email.cli
run-batch --file=/opt/jboss/wildfly/cli/logging.cli
run-batch --file=/opt/jboss/wildfly/cli/reverse-proxy.cli
run-batch --file=/opt/jboss/wildfly/cli/deploy-scanner.cli
run-batch --file=/opt/jboss/wildfly/cli/transactions.cli
stop-embedded-server
2 changes: 2 additions & 0 deletions docker/configs/cli/transactions.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Change transaction timeout
/subsystem=transactions/:write-attribute(name=default-timeout,value="${env.DEFAULT_TX_TIMEOUT:300}")
Original file line number Diff line number Diff line change
Expand Up @@ -565,21 +565,14 @@ public PersistenceActionResult createOrUpdate(Repository repository, CustomEntit

// Create referenced entities and set UUIDs in the values
Map<String, Object> tmpValues = ceiToSave.getCfValuesAsValues() != null ? new HashMap<>(ceiToSave.getCfValuesAsValues()) : new HashMap<>();
Map<String, Object> entityValues = createEntityReferences(repository, tmpValues, cet);
Map<String, Object> entityValues = createEntityReferences(repository, tmpValues, cet,customFieldTemplates);
customFieldInstanceService.setCfValues(cei, entityValues);

String uuid = null;

// First check if data exist, in order to synchronize UUID across all storages
String foundId;

List<String> secretFields = customFieldTemplates.values()
.stream()
.filter(cft -> cft.getFieldType() == CustomFieldTypeEnum.SECRET)
.filter(cft -> cei.get(cft.getCode()) != null)
.map(CustomFieldTemplate::getCode)
.collect(Collectors.toList());

try {
if (ceiToSave.getUuid() != null && exists(repository, cet, ceiToSave.getUuid())) {
foundId = ceiToSave.getUuid();
Expand All @@ -590,37 +583,7 @@ public PersistenceActionResult createOrUpdate(Repository repository, CustomEntit
// It's no problem if we can't retrieve record using values - we consider it does not exist
foundId = null;
}

if (foundId != null) {
cei.setUuid(foundId);
// Handle secret fields
if(!secretFields.isEmpty()) {
var foundCei = CEIUtils.pojoToCei(find(repository, cet, foundId, false));
String oldCeiHash = CEIUtils.getHash(foundCei, customFieldTemplates);
secretFields.forEach(secretField -> {
// Secret field has not changed, decrypt it so it will be correctly re-encrypted
if(cei.get(secretField).equals(foundCei.get(secretField))) {
String decryptedValue = PasswordUtils.decryptNoSecret(oldCeiHash, cei.get(secretField));
cei.getCfValues().setValue(secretField, decryptedValue);
entityValues.put(secretField, decryptedValue);
}
});
}
}

// Encrypt secret fields
if(!secretFields.isEmpty()) {
String ceiHash = CEIUtils.getHash(cei, customFieldTemplates);
secretFields.forEach(secretField -> {
String secretValue = cei.get(secretField);
if(!secretValue.startsWith("🔒")) { // Value is already encrypted
String encryptedValue = PasswordUtils.encryptNoSecret(ceiHash, secretValue);
cei.getCfValues().setValue(secretField, encryptedValue);
entityValues.put(secretField, encryptedValue);
}
});
}


var listener = customEntityTemplateService.loadCrudEventListener(cei.getCet());
CustomEntity cetClassInstance = null;

Expand All @@ -643,11 +606,50 @@ public PersistenceActionResult createOrUpdate(Repository repository, CustomEntit

ceiAfterPreEvents = CEIUtils.pojoToCei(cetClassInstance); // Handle case where entity was modified
ceiAfterPreEvents.setCet(cei.getCet());
ceiAfterPreEvents.setFieldTemplates(customFieldTemplates);
}

} catch (Exception e) {
throw new RuntimeException(e);
}

List<String> secretFields = new ArrayList<>();
for( CustomFieldTemplate cft :customFieldTemplates.values()){
if(ceiAfterPreEvents.get(cft.getCode()) != null && cft.getFieldType() == CustomFieldTypeEnum.SECRET){
secretFields.add(cft.getCode());
}
}

if (foundId != null) {
ceiAfterPreEvents.setUuid(foundId);
// Handle secret fields
if(!secretFields.isEmpty()) {
var foundCei = CEIUtils.pojoToCei(find(repository, cet, foundId, false));
String oldCeiHash = CEIUtils.getHash(foundCei, customFieldTemplates);
for(String secretField:secretFields) {
// Secret field has not changed, decrypt it so it will be correctly re-encrypted
if(ceiAfterPreEvents.get(secretField).equals(foundCei.get(secretField))) {
String decryptedValue = PasswordUtils.decryptNoSecret(oldCeiHash, ceiAfterPreEvents.get(secretField));
cei.getCfValues().setValue(secretField, decryptedValue);
entityValues.put(secretField, decryptedValue);
}
};
}
}

// Encrypt secret fields
if(!secretFields.isEmpty()) {
String ceiHash = CEIUtils.getHash(ceiAfterPreEvents, customFieldTemplates);
for(String secretField:secretFields) {
String secretValue = ceiAfterPreEvents.get(secretField);
if(!secretValue.startsWith("🔒")) { // Value is already encrypted
String encryptedValue = PasswordUtils.encryptNoSecret(ceiHash, secretValue);
ceiAfterPreEvents.getCfValues().setValue(secretField, encryptedValue);
entityValues.put(secretField, encryptedValue);
}
};
}


try {

Expand Down Expand Up @@ -909,10 +911,9 @@ public void setBinaries(Repository repository, CustomEntityTemplate cet, CustomF
}
}

private Map<String, Object> createEntityReferences(Repository repository, Map<String, Object> entityValues, CustomEntityTemplate cet) throws BusinessException, IOException, BusinessApiException, EntityDoesNotExistsException {
private Map<String, Object> createEntityReferences(Repository repository, Map<String, Object> entityValues, CustomEntityTemplate cet,Map<String, CustomFieldTemplate> cfts) throws BusinessException, IOException, BusinessApiException, EntityDoesNotExistsException {
Map<String, Object> updatedValues = new HashMap<>(entityValues);

Map<String, CustomFieldTemplate> cfts = customFieldTemplateService.getCftsWithInheritedFields(cet);
List<CustomFieldTemplate> cetFields = updatedValues.keySet()
.stream()
.map(cfts::get)
Expand All @@ -928,7 +929,10 @@ private Map<String, Object> createEntityReferences(Repository repository, Map<St
createCetReference(repository, updatedValues, customFieldTemplate, referencedCet);

} else {
jpaReferences.put(customFieldTemplate.getCode(), updatedValues.get(customFieldTemplate.getCode()));
Object value = updatedValues.get(customFieldTemplate.getCode());
if(value!=null){
jpaReferences.put(customFieldTemplate.getCode(), value);
}
}
}
}
Expand Down Expand Up @@ -1105,6 +1109,7 @@ protected PersistenceActionResult createReferencedEntity(Repository repository,
CustomEntityInstance cei = new CustomEntityInstance();
cei.setCetCode(customFieldTemplate.getEntityClazzCetCode());
cei.setCode((String) values.get("code"));
cei.setCet(customEntityTemplateService.findByCode(customFieldTemplate.getEntityClazzCetCode()));
cei.setRepository(repository);
String uuid = (String) values.get("uuid");
if (uuid != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package org.meveo.persistence;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -57,7 +58,7 @@ private void postConstruct() {
storages.forEach(StorageImpl::init);
}

public void beginTransaction(Repository repository, List<DBStorageType> storages) {
public void beginTransaction(Repository repository, Collection<DBStorageType> storages) {
for (var storage : storages) {
var impl = provider.findImplementation(storage);
for (var storageConf : repository.getStorageConfigurations(storage)) {
Expand All @@ -77,7 +78,7 @@ public <T> T beginTransaction(Repository repository, DBStorageType storage) {
}


public void commitTransaction(Repository repository, List<DBStorageType> storages) {
public void commitTransaction(Repository repository, Collection<DBStorageType> storages) {
stackedCalls--;

if(stackedCalls == 0) {
Expand All @@ -90,7 +91,7 @@ public void commitTransaction(Repository repository, List<DBStorageType> storage
}
}

public void rollbackTransaction(Exception exception, List<DBStorageType> storages) {
public void rollbackTransaction(Exception exception, Collection<DBStorageType> storages) {
log.warn("Transaction rolled back : ", exception);
stackedCalls--;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ public PersistenceActionResult addCetNode(String neo4JConfiguration, CustomEntit
final List<String> labels = getAdditionalLabels(cet);
if (applicableConstraints.isEmpty()) {
var existingNode = neo4jDao.findNodeById(neo4JConfiguration, cet.getCode(), uuid);
if (uniqueFields.isEmpty() && (existingNode == null || existingNode.isEmpty())) {
boolean nodeNotFound = (existingNode == null || existingNode.isEmpty());
if (uniqueFields.isEmpty() && nodeNotFound) {
String nodeId = neo4jDao.createNode(neo4JConfiguration, cet.getCode(), fields, labels, uuid);

if(nodeId != null) {
Expand All @@ -435,7 +436,14 @@ public PersistenceActionResult addCetNode(String neo4JConfiguration, CustomEntit
} else {
Map<String, Object> editableFields = getEditableFields(cetFields, fields);
// Pass an empty map as unique fields to force merge using only the uuid as merge key
String nodeId = neo4jDao.mergeNode(neo4JConfiguration, cet.getCode(), Map.of(), fields, editableFields, labels, uuid);
String nodeId = neo4jDao.mergeNode(
neo4JConfiguration,
cet.getCode(),
nodeNotFound ? uniqueFields : Map.of(),
fields,
editableFields,
labels,
uuid);

if(nodeId != null) {
persistedEntities.add(new EntityRef(nodeId, cet.getCode()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -311,9 +312,9 @@ private Collection<GraphQLEntity> getEntities(Neo4JConfiguration neo4jConfigurat
final CustomEntityTemplate startNode = relationshipTemplate.getStartNode();

// IF either the relation, the start entity or the end entity is not configured to be stored in Neo4J, don't include it in the generated graphql
final List<DBStorageType> relationStorages = relationshipTemplate.getAvailableStorages() != null ? relationshipTemplate.getAvailableStorages() : new ArrayList<>();
final List<DBStorageType> endNodeStorages = endNode.getAvailableStorages() != null ? endNode.getAvailableStorages() : new ArrayList<>();
final List<DBStorageType> startNodeStorages = startNode.getAvailableStorages() != null ? startNode.getAvailableStorages() : new ArrayList<>();
final Set<DBStorageType> relationStorages = relationshipTemplate.getAvailableStorages() != null ? relationshipTemplate.getAvailableStorages() : new HashSet<>();
final Set<DBStorageType> endNodeStorages = endNode.getAvailableStorages() != null ? endNode.getAvailableStorages() : new HashSet<>();
final Set<DBStorageType> startNodeStorages = startNode.getAvailableStorages() != null ? startNode.getAvailableStorages() : new HashSet<>();

if (!relationStorages.contains(DBStorageType.NEO4J) || !endNodeStorages.contains(DBStorageType.NEO4J) || !startNodeStorages.contains(DBStorageType.NEO4J)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,10 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hashCode(uuid);
}

@Override
public String toString() {
return "EntityRef [uuid=" + uuid + ", label=" + label + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,11 @@ public void remove(String sqlConnectionCode, CustomEntityTemplate template) thro

// Remove records in children tables
var subTemplates = customEntityTemplateService.getSubTemplates(template);
subTemplates.forEach(subT -> doUpdate(sqlConnectionCode, "delete from " + tableName(subT), (ps) -> {}));
subTemplates.forEach(subT -> {
if (subT.isStoreAsTable()) {
doUpdate(sqlConnectionCode, "delete from " + tableName(subT), (ps) -> {});
}
});

// Gather uuids to delete
List<String> uuids = getEntityManager(sqlConnectionCode)
Expand Down Expand Up @@ -981,7 +985,11 @@ public void remove(String sqlConnectionCode, CustomEntityTemplate template) thro
public void remove(String sqlConnectionCode, CustomEntityTemplate template, Collection<String> ids) throws BusinessException {
// Remove record in children tables
var subTemplates = customEntityTemplateService.getSubTemplates(template);
subTemplates.forEach(subT -> removeRecords(sqlConnectionCode, tableName(subT), ids));
subTemplates.forEach(subT -> {
if (subT.isStoreAsTable()) {
removeRecords(sqlConnectionCode, tableName(subT), ids);
}
});

// Remove in own table
removeRecords(sqlConnectionCode, tableName(template), ids);
Expand Down Expand Up @@ -1030,7 +1038,11 @@ private void removeRecords(String sqlConnectionCode, String tableName, Collectio
public void remove(String sqlConnectionCode, CustomEntityTemplate template, String uuid) throws BusinessException {
// Remove record in children tables
var subTemplates = customEntityTemplateService.getSubTemplates(template);
subTemplates.forEach(subT -> removeRecord(sqlConnectionCode, uuid, tableName(subT)));
subTemplates.forEach(subT -> {
if (subT.isStoreAsTable()) {
removeRecord(sqlConnectionCode, uuid, tableName(subT));
}
});

// Remove in own table
removeRecord(sqlConnectionCode, uuid, tableName(template));
Expand Down
Loading