Skip to content

Commit

Permalink
Merge branch '2024-03-27-pre-6-0-test'
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorgner committed Apr 9, 2024
2 parents 4841a9a + fe90970 commit 5d9687f
Show file tree
Hide file tree
Showing 459 changed files with 15,116 additions and 10,353 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
variableName: REST
- module: structr-db-driver-api
variableName: DB_DRIVER_API
- module: structr-memgraph-driver
variableName: MEMGRAPH_DRIVER
- module: structr-memory-driver
variableName: MEMORY_DRIVER
# - module: structr-memgraph-driver
# variableName: MEMGRAPH_DRIVER
# - module: structr-memory-driver
# variableName: MEMORY_DRIVER
- module: structr-modules
variableName: MODULES
- module: structr-neo4j-bolt-driver
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ docs/screenshots
*.DS_Store
**nbactions.xml
import-*.log
msg

# IntelliJ specific ignores
.idea
Expand All @@ -47,4 +48,8 @@ neo4j*/
*license.key*

# actions
**/*.secrets
**/*.secrets

# files and folders created during test execution
structr-modules/structr-file-access-module/structr_hostkey
structr-ui/changelog/
11 changes: 10 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.license>structr-gpl30</netbeans.hint.license>
<test.neo4j.version>neo4j:4.4</test.neo4j.version>
<test.neo4j.version>neo4j:5.16</test.neo4j.version>
<structr.lib.directory>${structr.root.directory}/structr-base/target/lib</structr.lib.directory>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
<maven.plugin.jar.version>3.2.0</maven.plugin.jar.version>
Expand All @@ -62,8 +62,10 @@
<modules>
<module>structr-db-driver-api</module>
<module>structr-neo4j-bolt-driver</module>
<!--
<module>structr-memory-driver</module>
<module>structr-memgraph-driver</module>
-->
<module>structr-base</module>
<module>structr-core</module>
<module>structr-rest</module>
Expand Down Expand Up @@ -178,6 +180,12 @@
<version>3.2.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -376,6 +384,7 @@
<target>17</target>
<encoding>${project.build.sourceEncoding}</encoding>
<debug>true</debug>
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
<plugin>
Expand Down
25 changes: 18 additions & 7 deletions structr-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@
<artifactId>graphql-java</artifactId>
<version>12.0</version>
</dependency>
<dependency>
<groupId>de.mpg.mpi-inf</groupId>
<artifactId>javatools</artifactId>
<version>1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.sdk/graal-sdk -->
<dependency>
<groupId>org.graalvm.sdk</groupId>
Expand Down Expand Up @@ -219,14 +214,12 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jaxb.version}</version>
<optional>true</optional>
</dependency>
<!-- JAXB RI, Jakarta XML Binding -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -539,6 +532,24 @@
<artifactId>jgroups-kubernetes</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion structr-base/src/main/java/org/structr/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.structr.common.VersionHelper;
import org.structr.common.helper.VersionHelper;
import org.structr.core.Services;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void injectArguments(Command command) {
}

@Override
public ServiceResult initialize(final StructrServices services, String serviceName) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
public ServiceResult initialize(final StructrServices services, String serviceName) throws ReflectiveOperationException {
return new ServiceResult(true);
}

Expand Down Expand Up @@ -245,7 +245,7 @@ private Agent lookupAgent(Task task) {

try {

Agent supportedAgent = supportedAgentClass.newInstance();
Agent supportedAgent = supportedAgentClass.getDeclaredConstructor().newInstance();
Class supportedTaskClass = supportedAgent.getSupportedTaskType();

if (supportedTaskClass.equals(taskClass)) {
Expand All @@ -262,7 +262,7 @@ private Agent lookupAgent(Task task) {
if (agentClass != null) {

try {
agent = (Agent) agentClass.newInstance();
agent = (Agent) agentClass.getDeclaredConstructor().newInstance();

} catch (Throwable ignore) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
import org.structr.core.app.StructrApp;
import org.structr.core.entity.AbstractSchemaNode;
import org.structr.core.entity.SchemaMethod;
import org.structr.core.entity.SchemaNode;
import org.structr.core.entity.SchemaProperty;
import org.structr.core.function.Functions;
import org.structr.core.function.ParseResult;
import org.structr.core.graph.NodeInterface;
import org.structr.core.graph.Tx;
import org.structr.core.property.*;
import org.structr.core.script.polyglot.function.DoAsFunction;
import org.structr.core.script.polyglot.function.DoInNewTransactionFunction;
Expand All @@ -48,10 +46,11 @@
import org.structr.web.entity.dom.Content.ContentHandler;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.structr.core.api.AbstractMethod;
import org.structr.core.api.Methods;
import org.structr.core.graph.Tx;



Expand Down Expand Up @@ -209,7 +208,7 @@ protected void addAllHints(final ActionContext actionContext, final List<Abstrac
final List<SchemaMethod> methods = StructrApp.getInstance().nodeQuery(SchemaMethod.class).and(SchemaMethod.schemaNode, null).sort(SchemaMethod.name, true).getAsList();

for (final SchemaMethod method : methods) {
hints.add(0, new GlobalSchemaMethodHint(method.getName(), method.getProperty(SchemaMethod.summary), method.getProperty(SchemaMethod.description)));
hints.add(0, new UserDefinedFunctionHint(method.getName(), method.getProperty(SchemaMethod.summary), method.getProperty(SchemaMethod.description)));
}

tx.success();
Expand Down Expand Up @@ -257,20 +256,12 @@ protected void addHintsForType(final ActionContext actionContext, final Class ty

// entity methods
// go into their own collection, are sorted and the appended to the list
final SchemaNode typeNode = StructrApp.getInstance().nodeQuery(SchemaNode.class).and(SchemaNode.name, type.getSimpleName()).getFirst();

final Map<String, Method> methods = StructrApp.getConfiguration().getExportedMethodsForType(type);
for (final Entry<String, Method> entry : methods.entrySet()) {
final Collection<AbstractMethod> methods = Methods.getAllMethods(type).values();
for (final AbstractMethod method : methods) {

final String name = entry.getKey();
String methodSummary = "";
String methodDescription = "";

final SchemaMethod schemaMethod = StructrApp.getInstance().nodeQuery(SchemaMethod.class).and(SchemaMethod.schemaNode, typeNode).andName(name).getFirst();
if (schemaMethod != null) {
methodSummary = schemaMethod.getProperty(SchemaMethod.summary);
methodDescription = schemaMethod.getProperty(SchemaMethod.description);
}
final String name = method.getName();
final String methodSummary = method.getSummary();
final String methodDescription = method.getDescription();

methodHints.add(new MethodHint(name, methodSummary, methodDescription));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/
package org.structr.autocomplete;

import org.structr.common.CaseHelper;
import org.structr.core.GraphObject;
import org.structr.core.function.ParseResult;
import org.structr.schema.action.ActionContext;

import java.util.LinkedList;
import java.util.List;
import org.structr.common.helper.CaseHelper;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.structr.common.CaseHelper;
import org.structr.core.GraphObject;
import org.structr.core.function.ParseResult;
import org.structr.schema.action.ActionContext;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.structr.common.helper.CaseHelper;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
*/
package org.structr.autocomplete;

public class GlobalSchemaMethodHint extends MethodHint {
public class UserDefinedFunctionHint extends MethodHint {

public GlobalSchemaMethodHint(String name, String summary, String description) {
public UserDefinedFunctionHint(String name, String summary, String description) {
super(name, summary, description);
}

@Override
public String getReplacement() {
return "globalSchemaMethods." + getDisplayName();
return "$." + getDisplayName();
}

@Override
public String getType() {
return "Global schema method";
return "User-defined function";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public Boolean setProperty(final GraphObject entity, final PropertyKey<Boolean>
typeName = declaringClass.getSimpleName();
}

throw new FrameworkException(422, typeName + "." + key.jsonName() + " is_read_only_property", new ReadOnlyPropertyToken(typeName, key));
throw new FrameworkException(422, typeName + "." + key.jsonName() + " is_read_only_property", new ReadOnlyPropertyToken(typeName, key.jsonName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.structr.core.property.GenericProperty;

import java.util.*;
import org.structr.common.helper.AdvancedMailContainer;

/**
* Encapsulates all information stored for Action-/SecurityContexts which are available via scripting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.structr.common.error.ErrorBuffer;
import org.structr.common.error.SemanticErrorToken;
import org.structr.common.helper.ValidationHelper;
import org.structr.core.app.StructrApp;
import org.structr.core.graph.NodeInterface;
import org.structr.core.property.PropertyKey;
Expand Down Expand Up @@ -49,7 +50,7 @@ public boolean isValid(final NodeInterface node, final ErrorBuffer errorBuffer)

valid = false;

errorBuffer.add(new SemanticErrorToken(type.getSimpleName(), eMail, "must_contain_at_character", _eMail));
errorBuffer.add(new SemanticErrorToken(type.getSimpleName(), "eMail", "must_contain_at_character").withDetail(_eMail));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ public Object evaluate(ActionContext actionContext, String key, String defaultVa
throw new UnsupportedOperationException("Not supported by this container.");
}

@Override
public Object invokeMethod(final SecurityContext securityContext, final String methodName, final Map<String, Object> parameters, boolean throwExceptionForUnknownMethods, final EvaluationHints hints) throws FrameworkException {
throw new UnsupportedOperationException("Not supported by this container.");
}

@Override
public List<GraphObject> getSyncData() throws FrameworkException {
throw new UnsupportedOperationException("Not supported by this container.");
Expand Down
18 changes: 12 additions & 6 deletions structr-base/src/main/java/org/structr/common/SecurityContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,13 +706,19 @@ public Locale getEffectiveLocale() {

if (cachedUser != null) {

// Priority 2: User locale
final String userLocaleString = cachedUser.getLocale();
if (userLocaleString != null) {
try (final Tx tx = StructrApp.getInstance().tx()) {

userHasLocaleString = true;
locale = Locale.forLanguageTag(userLocaleString.replaceAll("_", "-"));
}
// Priority 2: User locale
final String userLocaleString = cachedUser.getLocale();
if (userLocaleString != null) {

userHasLocaleString = true;
locale = Locale.forLanguageTag(userLocaleString.replaceAll("_", "-"));
}

tx.success();

} catch (FrameworkException fex) {}
}

if (request != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
package org.structr.common.error;

import com.google.gson.*;
import java.util.LinkedHashMap;
import java.util.Map;

/**
* Exception to be thrown when an unlicensed scripting function is encountered.
*/
public class AssertException extends RuntimeException implements JsonException {

private int statusCode = 422;
private final Map<String, String> headers = new LinkedHashMap<>();
private int statusCode = 422;

public AssertException(final String message, final int statusCode) {

Expand All @@ -39,6 +42,11 @@ public int getStatus() {
return statusCode;
}

@Override
public Map<String, String> headers() {
return headers;
}

@Override
public JsonElement toJSON() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
public class CardinalityToken extends SemanticErrorToken {

public CardinalityToken(final String type, final String errorMessage) {
super(type, null, "cardinality_mismatch", errorMessage);

super(type, null, "cardinality_mismatch");

withDetail(errorMessage);
}
}
Loading

0 comments on commit 5d9687f

Please sign in to comment.