Skip to content

Instantly share code, notes, and snippets.

View sperez2-seidor's full-sized avatar
🐢

Sergio Pérez sperez2-seidor

🐢
View GitHub Profile
import de.hybris.platform.core.Registry
import de.hybris.platform.jdbcwrapper.HybrisDataSource
import java.sql.Connection
import java.sql.PreparedStatement
import java.sql.ResultSet
import java.sql.SQLException
import java.text.SimpleDateFormat
// Get the data source
def dataSource = Registry.getCurrentTenant().getDataSource()
import de.hybris.platform.servicelayer.impex.ImportService
import de.hybris.platform.servicelayer.impex.impl.StreamBasedImpExResource
def importService = spring.getBean("importService")
def impexContent = """
# Import the ScriptingJob
INSERT_UPDATE ScriptingJob; code[unique = true] ; scriptURI
; inboundRequestMassiveCleanup ; model://inboundRequestMassiveCleanup
# Set up the CronJob
SELECT
t.NAME AS 'Table Name',
p.rows AS 'Num Rows',
CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS 'Used Space (MB)'
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
@sperez2-seidor
sperez2-seidor / testing-nexus-seidor.ts
Last active February 27, 2024 10:50
Script ot publish in Nexus
/*
* SPDX-FileCopyrightText: 2024 SAP Spartacus team <spartacus-team@sap.com>
*
* SPDX-License-Identifier: Apache-2.0
*
* Based in: https://github.com/SAP/spartacus/blob/develop/tools/schematics/testing.ts
*
* Script ot publish in Nexus
*
* To run:
@sperez2-seidor
sperez2-seidor / sap-commerce-architecture.md
Created October 30, 2023 10:08
SAP Commerce Architecture

SAP Commerce Architecture

image

@sperez2-seidor
sperez2-seidor / direct-finance.md
Created October 30, 2023 09:41
Direct Finance

Direct Finance

Local Environment Setup

INTRODUCTION

This is not by any means an exhaustive guide of how to build a SAP Commerce project, this is just a collection of basic guidelines that worked for me to create a project from scratch quickly. For a full guide check out SAP Commerce documentation (https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/8be4e0379b294fbabf36d26e7ca4169d/4e00fd71f0dd4dcab248f022a8c98d3d.html?version=v2205).

Also, this guide is made with a Debian based distribution in mind, however, the majority of commands will work fine in any Unix-like OS, the ones that will not work are mainly the installation commands that will require to be replaced by commands of your package manager of choice. In any case, every step is explained so even Windows users can follow this guide using their ui.

@sperez2-seidor
sperez2-seidor / add-repository-with-access-token-in-sap-commerce-cloud-portal.md
Created October 30, 2023 09:41
Add Repository with Access Token in SAP Commerce Cloud Portal

Add Repository with Access Token in SAP Commerce Cloud Portal

To log in to your GitLab account on SAP Commerce Cloud portal using an HTTP user and token, you can follow these steps:

  1. Log in to your GitLab account and navigate to your repository.
  2. Click on "Settings" > "Access Tokens" from the left-hand side menu.
  3. Create a new access token by entering a name (token "Username"), expiration date, select the role (Reporter), selecting the desired scopes (api, read_repository).
  4. Click on the "Create project access token" button.
  5. Copy the generated access token to your clipboard.
@sperez2-seidor
sperez2-seidor / partial-sync-sap-commerce.groovy
Created October 30, 2023 09:41
Partial Sync SAP Commerce
import de.hybris.platform.cmsfacades.data.SyncRequestData
import de.hybris.platform.cmsfacades.synchronization.service.ItemSynchronizationService
import de.hybris.platform.core.model.product.ProductModel
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery
import de.hybris.platform.servicelayer.search.SearchResult
import org.apache.commons.collections.CollectionUtils
flexibleSearchService = spring.getBean 'flexibleSearchService'
ItemSynchronizationService itemSynchronizationService = spring.getBean 'itemSynchronizationService'
syncConfig = spring.getBean 'syncConfig'
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"type": "rectangle",
"version": 563,
"versionNonce": 1749986308,
"isDeleted": false,
@sperez2-seidor
sperez2-seidor / opensearch-in-sap-commerce.md
Created October 30, 2023 09:41
OpenSearch in SAP Commerce

OpenSearch in SAP Commerce

OpenSearch

OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0. Powered by Apache Lucene and driven by the OpenSearch Project community.

Why OpenSearch?

  1. Amazon/3r parties selling ELK stack as a service
  2. Amazon/3rd parties were not contributing enough to the project