### Start and Enable Kuwaiba Service
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_b.md
Use these commands to start the Kuwaiba service immediately and to ensure it starts automatically on system boot.
```bash
sudo systemctl start program-name
```
```bash
sudo systemctl enable program-name
```
--------------------------------
### Run Kuwaiba Server in Foreground
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Use this command to start the Kuwaiba server in the foreground. Logs will be directed to standard output. Ensure you have the correct Java installation path and JAR file name.
```bash
/path/to/java/installation/dir/bin/java -jar /path/to/kuwaiba/kuwaiba_server_2.1.x-stable.jar
```
--------------------------------
### Start Kuwaiba Standalone Server
Source: https://context7.com/neotropicsas/kuwaiba-docs/llms.txt
Use these commands to start the Kuwaiba server as a standalone Java application. Ensure you have the correct Java installation and JAR file paths. For production, run as a restricted user with nohup for background execution and logging.
```bash
# Start the server in foreground
/path/to/java/installation/dir/bin/java -jar /path/to/kuwaiba/kuwaiba_server_2.1.x-stable.jar
```
```bash
# Start in background with nohup (logs to ~/nohup.out)
nohup /path/to/java/installation/dir/bin/java -jar kuwaiba_server_2.1-stable.jar&
```
```bash
# Run as a restricted user in production
sudo runuser -u YOURUSER -- nohup /path/to/java/installation/dir/bin/java -jar kuwaiba_server_2.1-stable.jar&
```
--------------------------------
### Start Neo4j Server
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Starts the Neo4j server, making it accessible at http://localhost:7474. This is used to check current database indices before migration.
```bash
$Neo4j_HOME/bin/neo4j start
```
--------------------------------
### Naming Pattern Examples
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/appendixes/appendix_a.md
Provides examples of combined naming patterns using static strings and dynamic functions.
```text
router-[sequence(1,3)]-[sequence(a,c)]
```
```text
[value(1111,name)]-[sequence(A,Z)]
```
--------------------------------
### Mirror Function Example
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/appendixes/appendix_a.md
Shows how the mirror function creates pairs of ports, connecting them as mirror ports.
```text
[mirror(a,b)]
```
```text
[mirror(1,10)]
```
--------------------------------
### Install Nginx on Debian/Ubuntu
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_c.md
Update package lists and install the Nginx web server. This is a prerequisite for setting up the reverse proxy.
```bash
sudo apt update
```
```bash
sudo apt install nginx
```
--------------------------------
### Start Neo4j Migration Console
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Initiates the Neo4j database migration process and starts the Neo4j server. The server will be accessible at http://localhost:7474 upon completion.
```bash
$New_Neo4j_HOME/bin/neo4j console
```
--------------------------------
### Hardware Import Example Script
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/tutorials/src/operation/bulk-upload/README.md
This Groovy script demonstrates a more complex, real-world scenario for importing hardware data, specifically from Huawei's U2000 DWDM NMS. It showcases advanced techniques and optimizations.
```groovy
//
// Kuwaiba - Task Manager
//
// Copyright (c) 2015-2017 Neotropic SAS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
//
//
// TM_basic_hardware_import_u2000.groovy
//
// This script is an example of how to import hardware data from Huawei's
// U2000 DWDM NMS. It demonstrates how to use the Persistence API to create
// and update hardware objects in Kuwaiba.
//
// The script expects a CSV file as input, where each line represents a
// piece of hardware to be imported.
//
// The CSV file must have the following columns:
//
// - ne_name: The name of the network element.
// - ne_type: The type of the network element.
// - slot: The slot number of the hardware.
// - module: The module number of the hardware.
// - port: The port number of the hardware.
// - hardware_type: The type of the hardware.
// - description: A description of the hardware.
//
// The script will process each line of the CSV file and create or update
// the corresponding hardware object in Kuwaiba.
//
// The script also supports the following options:
//
// - fileName: The path to the CSV file to be imported.
// - commit: If set to true, the changes will be committed to the database.
// If set to false, the changes will not be committed.
//
// Example usage:
//
// fileName: /path/to/your/hardware_import.csv
// commit: false
//
import org.neotropic.kuwaiba.core.apis.persistence.business.BusinessEntityManager
import org.neotropic.kuwaiba.core.apis.persistence.business.QueryOptions
import org.neotropic.kuwaiba.core.apis.persistence.exceptions.KuwaibaBusinessException
import org.neotropic.kuwaiba.core.apis.persistence.exceptions.KuwaibaPersistenceException
import org.neotropic.kuwaiba.core.apis.persistence.util.BusinessObjectState
import org.neotropic.kuwaiba.core.apis.persistence.util.BusinessObjectUtils
import org.neotropic.kuwaiba.core.persistence.object.BusinessObject
import java.util.ArrayList
import java.util.HashMap
import java.util.List
import java.util.Map
// Task parameters
def fileName = taskParameters.get("fileName")
def commit = taskParameters.get("commit") ?: false
// Check if the file name is provided
if (fileName == null || fileName.isEmpty()) {
throw new KuwaibaBusinessException("fileName parameter is required.")
}
// Check if the file exists
def importFile = new File(fileName)
if (!importFile.exists()) {
throw new KuwaibaBusinessException("File not found: " + fileName)
}
// Get the BusinessEntityManager
def businessEntityManager = kuwaibaSession.getService(BusinessEntityManager.class)
// Read the CSV file
def lines = importFile.readLines()
// Skip the header row
lines.remove(0)
// Process each line
lines.eachWithIndex {
line, index ->
def parts = line.split(',')
if (parts.size() < 7) {
log.warn("Skipping invalid line ${index + 2}: ${line}")
return@eachWithIndex
}
def ne_name = parts[0].trim()
def ne_type = parts[1].trim()
def slot = parts[2].trim()
def module = parts[3].trim()
def port = parts[4].trim()
def hardware_type = parts[5].trim()
def description = parts[6].trim()
try {
// Find or create the Network Element
def neObject = businessEntityManager.getBusinessObject(ne_name)
if (neObject == null) {
neObject = businessEntityManager.createBusinessObject(ne_type, ne_name)
neObject.setDescription("Network Element: ${ne_name}")
neObject.setState(BusinessObjectState.ACTIVE)
businessEntityManager.saveBusinessObject(neObject)
log.info("Created Network Element: ${ne_type} '${ne_name}'")
}
// Find or create the Slot
def slotObject = businessEntityManager.getBusinessObject("${ne_name}-${slot}")
if (slotObject == null) {
slotObject = businessEntityManager.createBusinessObject("Slot", "${ne_name}-${slot}", neObject)
slotObject.setDescription("Slot ${slot}")
slotObject.setState(BusinessObjectState.ACTIVE)
businessEntityManager.saveBusinessObject(slotObject)
log.info("Created Slot: '${ne_name}-${slot}' under '${ne_name}'")
}
// Find or create the Module
def moduleObject = businessEntityManager.getBusinessObject("${ne_name}-${slot}-${module}")
if (moduleObject == null) {
moduleObject = businessEntityManager.createBusinessObject("Module", "${ne_name}-${slot}-${module}", slotObject)
moduleObject.setDescription("Module ${module}")
moduleObject.setState(BusinessObjectState.ACTIVE)
businessEntityManager.saveBusinessObject(moduleObject)
log.info("Created Module: '${ne_name}-${slot}-${module}' under '${ne_name}-${slot}'")
}
// Find or create the Port
def portObject = businessEntityManager.getBusinessObject("${ne_name}-${slot}-${module}-${port}")
if (portObject == null) {
portObject = businessEntityManager.createBusinessObject(hardware_type, "${ne_name}-${slot}-${module}-${port}", moduleObject)
portObject.setDescription(description)
portObject.setState(BusinessObjectState.ACTIVE)
businessEntityManager.saveBusinessObject(portObject)
log.info("Created Port: ${hardware_type} '${ne_name}-${slot}-${module}-${port}' under '${ne_name}-${slot}-${module}'")
} else {
// Update the existing port
portObject.setDescription(description)
businessEntityManager.saveBusinessObject(portObject)
log.info("Updated Port: ${hardware_type} '${ne_name}-${slot}-${module}-${port}'")
}
} catch (KuwaibaBusinessException | KuwaibaPersistenceException e) {
log.error("Error processing line ${index + 2}: ${line}", e)
}
}
// Commit or rollback changes
if (commit) {
businessEntityManager.commit()
log.info("Changes committed.")
} else {
businessEntityManager.rollback()
log.info("Changes rolled back.")
}
```
--------------------------------
### Initialize HTMLReport Instance
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/other/reports/README.md
Start by creating an instance of HTMLReport to build your report.
```Java
def report = new HTMLReport(String.format("Report's name","", "1.0"))
```
--------------------------------
### Port Mirroring Types and Setup
Source: https://context7.com/neotropicsas/kuwaiba-docs/llms.txt
Explains the types of port mirroring (1:1 and 1:N) and provides steps for setting up mirroring on a Splice Box, including automatic matching for ODFs.
```java
// Mirroring types:
// - mirror: 1:1 relationship (port A mirrors to port B)
// - mirrorMultiple: 1:N relationship (splitter: 1 input to N outputs)
// Setting up port mirroring on a Splice Box:
// 1. Navigate to Splice Box object
// 2. Advanced Actions -> Manage Port Mirroring
// 3. Select mirror type (Single Mirror or Multiple Mirror)
// 4. Drag port from Available Ports to Source Ports
// 5. Drag corresponding port to Target Ports
// 6. Mirrors are established
// Automatic mirror matching for ODFs:
// - Drag multiple ports to source/target areas
// - Click "Automatic Mirror Matching"
// - System creates mirrors based on port naming conventions
// View mirroring results:
// - Use Splice Box View to visualize connections
// - Blue = connected/in use
// - Gray = available
```
--------------------------------
### Install mdBook
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/tutorials/README.md
Install the mdBook tool using Cargo, Rust's package manager. Ensure you use the --locked and --version flags for a precise installation.
```bash
$ cargo install mdbook --locked --version
```
--------------------------------
### Sequence Function Examples
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/appendixes/appendix_a.md
Demonstrates the use of sequence functions for generating alphabetic and numeric sequences within naming patterns.
```text
[sequence(a,z)]
```
```text
[sequence(A,Z)]
```
```text
[sequence(n,m)]
```
--------------------------------
### Start Neo4j Server After Migration
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
After the migration process is complete and the server has been stopped (Ctrl + C), use this command to start the Neo4j server for version 4.4.17.
```bash
$New_Neo4j_HOME/bin/neo4j start
```
--------------------------------
### Prepare Neo4j Configuration for Upgrade
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Uncomment these lines in the neo4j.conf file to enable database upgrades and set the default database name. Ensure this is done before starting the migration process.
```properties
dbms.allow_upgrate=true
dbms.default_database=neo4j
```
--------------------------------
### Generic Bulk Import Example Script
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/tutorials/src/operation/bulk-upload/README.md
This Groovy script provides a template for bulk importing data into Kuwaiba. Ensure to read the header for instructions and tips. It requires a 'fileName' parameter pointing to the import file.
```groovy
//
// Kuwaiba - Task Manager
//
// Copyright (c) 2015-2017 Neotropic SAS
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
//
//
// TM_generic_bulk_import_example.groovy
//
// This script is a generic example of how to perform a bulk import.
// It is intended to be used as a starting point for creating your own
// import scripts.
//
// The script expects a CSV file as input, where each line represents
// an object to be created or updated.
//
// The CSV file must have the following columns:
//
// - type: The type of the object to be created or updated.
// - name: The name of the object.
// - parent: The name of the parent object.
// - description: A description of the object.
//
// The script will process each line of the CSV file and create or update
// the corresponding object in Kuwaiba.
//
// The script also supports the following options:
//
// - fileName: The path to the CSV file to be imported.
// - commit: If set to true, the changes will be committed to the database.
// If set to false, the changes will not be committed.
//
// Example usage:
//
// fileName: /path/to/your/import.csv
// commit: false
//
import org.neotropic.kuwaiba.core.apis.persistence.business.BusinessEntityManager
import org.neotropic.kuwaiba.core.apis.persistence.business.QueryOptions
import org.neotropic.kuwaiba.core.apis.persistence.exceptions.KuwaibaBusinessException
import org.neotropic.kuwaiba.core.apis.persistence.exceptions.KuwaibaPersistenceException
import org.neotropic.kuwaiba.core.apis.persistence.util.BusinessObjectState
import org.neotropic.kuwaiba.core.apis.persistence.util.BusinessObjectUtils
import org.neotropic.kuwaiba.core.persistence.object.BusinessObject
import java.util.ArrayList
import java.util.HashMap
import java.util.List
import java.util.Map
// Task parameters
def fileName = taskParameters.get("fileName")
def commit = taskParameters.get("commit") ?: false
// Check if the file name is provided
if (fileName == null || fileName.isEmpty()) {
throw new KuwaibaBusinessException("fileName parameter is required.")
}
// Check if the file exists
def importFile = new File(fileName)
if (!importFile.exists()) {
throw new KuwaibaBusinessException("File not found: " + fileName)
}
// Get the BusinessEntityManager
def businessEntityManager = kuwaibaSession.getService(BusinessEntityManager.class)
// Read the CSV file
def lines = importFile.readLines()
// Skip the header row
lines.remove(0)
// Process each line
lines.eachWithIndex {
line, index ->
def parts = line.split(',')
if (parts.size() < 3) {
log.warn("Skipping invalid line ${index + 2}: ${line}")
return@eachWithIndex
}
def type = parts[0].trim()
def name = parts[1].trim()
def parent = parts[2].trim()
def description = parts.size() > 3 ? parts[3].trim() : ""
try {
// Check if the parent object exists
def parentObject = businessEntityManager.getBusinessObject(parent)
if (parentObject == null) {
log.warn("Skipping line ${index + 2}: Parent object '${parent}' not found.")
return@eachWithIndex
}
// Check if the object already exists
def existingObject = businessEntityManager.getBusinessObject(name, type)
if (existingObject == null) {
// Create a new object
def newObject = businessEntityManager.createBusinessObject(type, name, parentObject)
newObject.setDescription(description)
newObject.setState(BusinessObjectState.ACTIVE)
businessEntityManager.saveBusinessObject(newObject)
log.info("Created object: ${type} '${name}' under '${parent}'")
} else {
// Update the existing object
existingObject.setDescription(description)
businessEntityManager.saveBusinessObject(existingObject)
log.info("Updated object: ${type} '${name}'")
}
} catch (KuwaibaBusinessException | KuwaibaPersistenceException e) {
log.error("Error processing line ${index + 2}: ${line}", e)
}
}
// Commit or rollback changes
if (commit) {
businessEntityManager.commit()
log.info("Changes committed.")
} else {
businessEntityManager.rollback()
log.info("Changes rolled back.")
}
```
--------------------------------
### Value Function Example
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/appendixes/appendix_a.md
Illustrates how to use the value function to insert an object's attribute value into a naming pattern.
```text
[value(Object Id,Object Class Name,Attribute Name)]
```
--------------------------------
### Start Kuwaiba Docker Container
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Runs a Kuwaiba Docker container, mapping application (8080) and SOAP web service (8081) ports to the host. The container is named 'kuwaiba-server'.
```bash
docker run -dp 8080-8081:8080-8081 --name kuwaiba-server neotropic/kuwaiba:v2.1-nightly
```
--------------------------------
### Multiple Mirror Function Example
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/appendixes/appendix_a.md
Demonstrates the use of the multiple-mirror function for creating fiber optic splitter ports with one input and multiple output ports.
```text
[multiple-mirror(a,b)]
```
```text
[multiple-mirror(2,5)]
```
--------------------------------
### Start Kuwaiba Docker Container with Custom Database
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Runs a Kuwaiba Docker container, mapping ports and mounting a custom database from the host to persist data across container updates. Ensure the host user has write access to the specified database path.
```bash
docker run -dp 8080-8081:8080-8081 --name kuwaiba-server -v /path/to/your/custom/database:/data/db/kuwaiba.db neotropic/kuwaiba:v2.1-nightly
```
--------------------------------
### Complete Inventory Report Generation
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/other/reports/README.md
This is a complete example demonstrating the generation of an inventory report listing cities and their states. It includes all necessary imports, object fetching, table creation, data population, and report assembly.
```Java
import org.neotropic.kuwaiba.modules.optional.reports.html.*
def report = new HTMLReport("City in inventory" , "Neotropic SAS", "1.0")
report.setEmbeddedStyleSheet(HTMLReport.getDefaultStyleSheet())
def cities = bem.getObjectsOfClassLight("City", null, -1, -1)
def citiesTable = new HTMLTable(null, null, ["City","State"] as String[])
cities.each { city ->
def state = bem.getParent( city.getClassName(), city.getId())
citiesTable.getRows().add(new HTMLRow([
new HTMLColumn( city.getName()),
new HTMLColumn(state),
] as HTMLColumn[]))
}
report.getComponents().add(citiesTable)
return report
```
--------------------------------
### Load Migrated Neo4j Database
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Load a backed-up Neo4j database into a new Neo4j 5.x.x installation. Use the --overwrite-destination=true flag if a database with the same name already exists and needs to be replaced.
```bash
New_Neo4j_HOME/bin/neo4j-admin database load --from-path=/path/to/dump/ file dump_file_name
```
```bash
New_Neo4j_HOME/bin/neo4j-admin database load --from-path=/neo4j/migration/ kuwaiba
```
--------------------------------
### Build Documentation
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/tutorials/README.md
Build the project documentation by running the mdbook build command in the project's root directory.
```bash
$ mdbook build
```
--------------------------------
### Enable Nginx Site Configuration
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_c.md
Create a symbolic link to enable the newly created Nginx configuration file for Kuwaiba. This tells Nginx to use this configuration at startup.
```bash
sudo ln -s /etc/nginx/sites-available/kuwaiba /etc/nginx/sites-enabled/
```
--------------------------------
### Drop Specific Neo4j Index Example
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Example of dropping an index for the 'name' property on nodes with the label 'classes'.
```cypher
DROP INDEX ON :`classes`(`name`);
```
--------------------------------
### Deploy Kuwaiba with Docker
Source: https://context7.com/neotropicsas/kuwaiba-docs/llms.txt
Instructions for pulling, running, and building Kuwaiba Docker images. Use port mapping for UI and SOAP services, and volume mounting for persistent database storage. Docker Compose is also supported.
```bash
# Pull the nightly build image
docker pull neotropic/kuwaiba:v2.1-nightly
```
```bash
# Run container with port mapping (8080=UI, 8081=SOAP web service)
docker run -dp 8080-8081:8080-8081 --name kuwaiba-server neotropic/kuwaiba:v2.1-nightly
```
```bash
# Run with custom database mounted from host (persistent data)
docker run -dp 8080-8081:8080-8081 --name kuwaiba-server \
-v /path/to/your/custom/database:/data/db/kuwaiba.db \
neotropic/kuwaiba:v2.1-nightly
```
```bash
# Build your own image from Dockerfile
docker build -t my-kuwaiba:latest .
```
```bash
# Or use docker compose
docker compose -f kuwaiba.yaml up
```
--------------------------------
### Check Nginx Service Status
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_c.md
Verify that the Nginx service is active and running after installation or configuration changes.
```bash
systemctl status nginx
```
--------------------------------
### Run Kuwaiba Server with Nohup
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Launch the Kuwaiba server using `nohup` to prevent termination upon logout. Output will be logged to `nohup.out` in the user's home directory unless redirected.
```bash
nohup /path/to/java/installation/dir/bin/java -jar kuwaiba_server_2.1-stable.jar&
```
--------------------------------
### Get Object Attributes
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/other/reports/README.md
Access attributes of a Business Object. This method is used when the object is a full Business Object.
```Java
object.getAttributes().get(attributeName)
```
--------------------------------
### Create Domain Certificate Extension File
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_e.md
Creates an empty file named `neotropic.co.ext` which will be used to configure certificate extensions.
```bash
touch neotropic.co.ext
```
--------------------------------
### Style HTML Div
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/other/reports/README.md
Applies CSS styles to an HTML div element to control its appearance and layout. This example centers the content within the div.
```Java
divTitle.setStyle("width: 100vw;display: flex; justify-content: center; align-items: center;padding:4px")
```
--------------------------------
### Create Data Source for Device Synchronization
Source: https://context7.com/neotropicsas/kuwaiba-docs/llms.txt
Steps to create a data source for a specific network device, linking it to a template and configuring property values.
```java
// Create data source for device:
// 1. Click "Data Sources"
// 2. Click "New Data Source"
// 3. Search and select inventory object (router, switch)
// 4. Select template
// 5. Configure property values (IP, credentials)
// 6. Save data source
```
--------------------------------
### Get Business Object Light Attributes
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/user/en/src/other/reports/README.md
Access specific attributes of a Business Object Light. Only name, class name, and ID are available for Business Object Light instances.
```Java
objectLight.getName()
objectLight.getClassName()
objectLight.getId()
```
--------------------------------
### Create UI View for Displaying Business Objects in Java
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/tutorials/src/dev/how-to-create-a-new-module/README.md
This UI class, annotated with @Route, creates a view to display BusinessObjectLight items. It initializes content, creates a title, and sets up a grid to show house data fetched from the RentHouseService. Error handling for data retrieval is included.
```java
// renthouse is the route of your view
@Route(value = "renthouse", layout = RentHouseLayout.class)
public class RentHouseUI extends VerticalLayout implements HasDynamicTitle,AbstractUI{
private final String MODULE_NAME = "RENT HOUSE BY: Neotropic SAS";
@Autowired
private RentHouseService rhs;
@Autowired
private TranslationService ts;
private H3 title;
private Grid gridObjects;
public RentHouseUI(){
super();
setSizeFull();
}
@Override
public void initContent() {
createTitle();
createGridObjects();
}
private void createTitle(){
this.title = new H3(MODULE_NAME);
add(this.title);
}
private void createGridObjects(){
try{
List objects = new ArrayList();
objects = this.rhs.findAllBusinessObjectLight("House", 1, 10);
this.gridObjects = new Grid<>(BusinessObjectLight.class, false);
this.gridObjects.addColumn(BusinessObjectLight::getId).setHeader("ID");
this.gridObjects.addColumn(BusinessObjectLight::getClassName).setHeader("Class Name");
this.gridObjects.addColumn(BusinessObjectLight::getName).setHeader("Name");
this.gridObjects.setItems(objects);
add(this.gridObjects);
}catch(InvalidArgumentException | MetadataObjectNotFoundException ex){
new SimpleNotification(ts.getTranslatedString("module.general.messages.error"), ex.getLocalizedMessage(),
AbstractNotification.NotificationType.ERROR, ts).open();
}
}
@Override
public String getPageTitle() {
return this.ts.getTranslatedString("module.rent.house.title");
}
}
```
--------------------------------
### Systemd Service File for Kuwaiba
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_b.md
Create this file in /etc/systemd/system/ to manage the Kuwaiba server as a systemd service. Ensure the User and ExecStart paths are correctly configured for your environment.
```bash
[Unit]
Description= Kuwaiba Open Network Inventory
After=network.target
[Service]
User=kuwaiba
ExecStart=nohup /usr/bin/java -jar /path/file/kuwaiba_server_2.1.x-stable.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
```
--------------------------------
### Test Nginx Configuration and Restart
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/appendixes/appendix_c.md
Test the Nginx configuration file for syntax errors and then restart the Nginx service to apply the changes.
```bash
sudo nginx -t
```
```bash
sudo systemctl restart nginx
```
--------------------------------
### Migrate Neo4j Configuration File
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/database-migration/README.md
Migrate Neo4j configuration files from an older version (e.g., 4.4.x) to a new Neo4j 5.x.x installation. This command requires specifying the paths for the old and new configuration directories.
```bash
`New_Neo4j_HOME/bin/`neo4j-admin server migrate-configuration --from-path=/$Neo4j_HOME/conf --to-path=/$New_Neo4j_HOME/conf/
```
--------------------------------
### Build Custom Kuwaiba Docker Image
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Builds a custom Docker image for Kuwaiba using a Dockerfile. Replace REPOSITORY_NAME and TAG with your desired values.
```bash
docker build -t REPOSITORY_NAME:TAG .
```
--------------------------------
### Deploy Kuwaiba with Docker Compose
Source: https://github.com/neotropicsas/kuwaiba-docs/blob/main/admin/en/src/installation/README.md
Deploys Kuwaiba using a docker compose file. Ensure the 'kuwaiba.yaml' file is in the current directory.
```bash
docker compose -f kuwaiba.yaml up
```