Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
154 changes: 154 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@

% Copilot instructions for the `oss` workspace

Purpose
-------
This file describes the default, workspace-specific instructions that an automated coding assistant (Copilot) should follow when making suggestions or applying edits in this repository. Follow these guidelines whenever you open, modify, or create files in this workspace.

Project overview
----------------
- Multi-module Java/Gradle project located at the repository root. Main Gradle wrapper files: `gradlew`, `gradlew.bat`, `build.gradle`, `settings.gradle`.
- Submodules live under `modules/`.
- Themes live under `themes/`. These are frontend assets (a `package.json`).

High-level goals for edits
-------------------------
1. Preserve build stability: avoid changes that break a full `./gradlew build` (on Windows: `gradlew.bat build`).
2. Make the minimal change necessary to implement a fix or feature.
3. Run and prefer project-provided build/test/format tooling before proposing changes as final.
4. When in doubt, add tests and keep public APIs backwards compatible.

How to build locally (Windows)
-------------------------------
Use the Gradle wrapper to build the whole project from the repository root:

```
gradlew.bat build
```

To run tests for a single module (example):

```
cd modules/registration-service
..\..\gradlew.bat :modules:registration-service:test
```

If you need a clean build:

```
gradlew.bat clean build
```

Frontend (node) tasks
----------------------
If you need to run Node/NPM tasks for the repo root frontend:

```
npm install
npm test
```

Adjust the working directory if you operate within a module with its own `package.json`.

Docker / local Liferay environment
----------------------------------
This repository includes a Docker-based Liferay development environment that can be started from the repository root. On Windows use the Gradle wrapper batch file; on Unix-like systems use the shell wrapper.

Start Docker/Liferay (Windows - cmd.exe):

```
gradlew.bat startLiferay
```

Start Docker/Liferay (Unix/macOS):

```
./gradlew startLiferay
```

Notes:
- Wait for the containers to finish starting before deploying modules. You can check container status with `docker ps` and inspect logs with `docker-compose logs` if needed.
- Once Docker/Liferay is up you can deploy modules from the repository root using Gradle. On Windows:

```
gradlew.bat deploy
```

Or on Unix/macOS:

```
./gradlew deploy
```

You can also deploy a single module by running the module's deploy task, for example:

```
cd modules/registration-service
..\..\gradlew.bat :modules:registration-service:deploy
```

Adjust paths and task names as needed for specific modules.

Formatting / linting
--------------------
- Keep existing formatting conventions. If the repo has a formatting tool configured, prefer using that (e.g. `./gradlew fmt` if present) before changing formatting manually.
- Add or update lint fixes conservatively and run the associated checks locally.

Testing requirements
--------------------
- For any non-trivial code change, add or update automated tests (unit tests or integration tests) that demonstrate the fix/feature.
- Run `gradlew.bat test` (or module-specific tasks) and ensure tests pass locally before finalizing changes.

Dependency management
---------------------
- When adding/updating dependencies update only the smallest set of build files necessary.
- Run `gradlew.bat build` after dependency changes to verify nothing else broke.
- Prefer using existing BOMs and aligned versions used across modules when possible.

Commit and PR guidelines
------------------------
- Keep commits small and focused: one logical change per commit.
- Commit messages should have a short summary and a short body when necessary. Example:

"Fix NPE in UserRegistrationService when email is null\n\n Add a null-check and a unit test that covers the edge case."

- When proposing changes as a patch in this workspace, include the commands you ran to validate (build/test) and a brief summary of results.

Files and directories to avoid / sensitive files
---------------------------------------------
- Do not open or modify secrets or local credential files unless the user explicitly asks and permits it. Examples in this repository include but may not be limited to:
- `gradle-local-with-pw.properties`
- `gradle-local.properties`
- `example-gradle-local.properties` (read-only example ok)
- any `*.keystore`, `*.p12`, or other credential artifacts

- Avoid leaking values from these files into diffs or suggestions.

When making automated edits
--------------------------
- Create minimal, well-scoped patches. Use the repository coding style and preserve formatting of surrounding code.
- Add missing imports and adjust related build files only when required.
- If a refactor touches many modules, prefer splitting into multiple PRs and run a full build after each stage.

If tests or build fail after an edit
----------------------------------
1. Re-run with `--stacktrace` and capture the failing task output.
2. Try to localize failure to a single module and create a failing unit test if one does not already exist.
3. Propose a fix with the minimal change and include the failing output and the verification steps in the patch description.

Additional helpful repository hints
----------------------------------
- The repository contains many frontend dependencies in `node_modules_cache/` (cached tarballs) — prefer using the provided `package.json` scripts rather than manual changes to `node_modules_cache`.

Contact / follow-up
-------------------
If you want me to open or modify specific files, list them and I will:
- read their current contents,
- propose the precise minimal patch(s), and
- run / describe the verification steps I used (build/test commands and results).

If you want stricter or different instructions (for example: prefer Kotlin DSL for Gradle, or use a specific Java style guide), update this file to reflect those preferences.

-- End of copilot-instructions.md


20 changes: 15 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ task startContainers(
System.out.println('dockerComposeFilePath: ' + dockerComposeFilePath)
System.out.println('bundleDir: ' + bundleDir)
exec {
executable 'podman'
args('compose', '-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'up', '--build', '--force-recreate', '-d')
// Docker compose
executable 'docker-compose'
args('-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'up', '--build', '--force-recreate', '-d')

// Podman
// executable 'podman'
// args('compose', '-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'up', '--build', '--force-recreate', '-d')
environment('LIFERAY_BUNDLE_DIR', bundleDir)
standardOutput = System.out
errorOutput = System.err
Expand Down Expand Up @@ -141,8 +146,13 @@ task stopLiferay(
) {
doLast {
exec {
executable 'podman'
args('compose', '-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'down', '--rmi', 'local')
// Docker Compose
executable 'docker-compose'
args('-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'down', '--rmi', 'local')

// Podman
// executable 'podman'
// args('compose', '-p', dockerContainerPrefix, '-f', dockerComposeFilePath, 'down', '--rmi', 'local')
standardOutput = System.out
errorOutput = System.err
}
Expand All @@ -156,7 +166,7 @@ task dumpDB(
) {
doLast {
exec {
executable 'podman'
executable 'docker-compose'
args('exec', '-t', "${dockerContainerPrefix}-mariadb-74", 'mysqldump', "-u${dbUser}", "-p${dbPassword}",
'--extended-insert=FALSE', '--no-autocommit', '--opt', "${dbName}")
standardOutput new FileOutputStream("${projectDir}/docker/resources/dump-${dbName}.sql")
Expand Down
16 changes: 8 additions & 8 deletions configs/artifacts-release.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.dsd.registration.api",
"version" : "1.1.0",
"version" : "1.1.1",
"extension" : "jar"
},
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.dsd.registration.service",
"version" : "1.1.0",
"version" : "1.1.1",
"extension" : "jar"
},
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.oss.download.api",
"version" : "1.1.2",
"version" : "1.1.3",
"extension" : "jar"
},
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.oss.download.service",
"version" : "1.1.2",
"version" : "1.1.3",
"extension" : "jar"
},
{
Expand All @@ -38,7 +38,7 @@
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.portal.common-utils",
"version" : "1.1.41",
"version" : "1.1.43",
"extension" : "jar"
},
{
Expand All @@ -50,7 +50,7 @@
{
"groupId" : "nl.deltares",
"artifactId" : "nl.worth.portal.context.contributor",
"version" : "1.1.3",
"version" : "1.1.4",
"extension" : "jar"
},
{
Expand Down Expand Up @@ -93,7 +93,7 @@
{
"groupId" : "nl.deltares",
"artifactId" : "nl.deltares.tableview.portlet",
"version" : "1.1.7",
"version" : "1.1.11",
"extension" : "jar"
},
{
Expand All @@ -117,7 +117,7 @@
{
"groupId" : "nl.deltares",
"artifactId" : "deltares-fews-theme",
"version" : "1.1.5",
"version" : "1.1.6",
"extension" : "war"
}
]
2 changes: 1 addition & 1 deletion modules/common-utils/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundle-Name: common-utils
Bundle-SymbolicName: nl.deltares.portal.common-utils
Bundle-Version: 1.1.41
Bundle-Version: 1.1.43
Export-Package: \
nl.deltares.portal.constants, \
nl.deltares.portal.utils, \
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package nl.deltares.portal.model.listeners;

import com.liferay.portal.kernel.exception.ModelListenerException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.BaseModelListener;
import com.liferay.portal.kernel.model.ModelListener;
import com.liferay.portal.kernel.model.User;
import nl.deltares.dsd.registration.service.RegistrationLocalService;
import nl.deltares.oss.download.service.DownloadLocalService;

import nl.deltares.portal.utils.AccountUtils;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

@Component(service = ModelListener.class)
public class UserModelListener extends BaseModelListener<User> {

private static final Log LOGGER = LogFactoryUtil.getLog(UserModelListener.class);

@Reference
private AccountUtils accountUtils;

@Reference
RegistrationLocalService registrationLocalService;

@Reference
DownloadLocalService downloadLocalService;

@Override
public void onAfterRemove(User model) throws ModelListenerException {
try {
int count = registrationLocalService.deleteAllUserRegistrations(model.getUserId());
if (count > 0) {
LOGGER.info(String.format("Deleting %d Registration references for user %d with email %s", count, model.getUserId(), model.getEmailAddress()));
}

count = downloadLocalService.deleteAllUserDownloads(model.getUserId());
if (count > 0) {
LOGGER.info(String.format("Deleting %d Download references for user %d with email %s", count, model.getUserId(), model.getEmailAddress()));
}

count = accountUtils.deleteUserPersonalAccount(model.getScreenName());
if (count > 0) {
LOGGER.info(String.format("Deleting personal account for user %d with email %s", model.getUserId(), model.getEmailAddress()));
}
} finally {
super.onAfterRemove(model);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ static String[] getSplitDomains(String domains) {
return new String[]{domains};
}
}

int deleteUserPersonalAccount(String screenName);
}
Loading
Loading