Sfoglia il codice sorgente

add custom fields to trace back to kafka db

feature/quarkus-rest-bridge
Gabriele Zigurella 2 anni fa
parent
commit
0e3d290aa3
  1. 6
      liferay-plugins-sdk-6.2/portlets/quarkus-bridge-portlet/docroot/WEB-INF/src/portos/nextmind/quarkus/bridge/api/QuarkusBridgeConstants.java
  2. 34
      liferay-plugins-sdk-6.2/portlets/quarkus-bridge-portlet/docroot/WEB-INF/src/portos/nextmind/quarkus/bridge/scheduler/QuarkusBridgeScheduler.java

6
liferay-plugins-sdk-6.2/portlets/quarkus-bridge-portlet/docroot/WEB-INF/src/portos/nextmind/quarkus/bridge/api/QuarkusBridgeConstants.java

@ -1,6 +1,7 @@
package portos.nextmind.quarkus.bridge.api;
public class QuarkusBridgeConstants {
public final static String HEADER_REQUEST = "HeaderPratica";
public final static String BODY_REQUEST = "SportelloPratica";
public final static String codiceIstat = "cadastralCode";
@ -9,4 +10,9 @@ public class QuarkusBridgeConstants {
public final static String nome = "name";
public final static String cognome = "surname";
public final static String tipoProcedura = "proceedingType";
public final static String instanceId = "instanceId";
public final static String correlationId = "correlationId";
public final static String clientId = "clientId";
public final static String recordId = "id"; // The generated id in the external database
}

34
liferay-plugins-sdk-6.2/portlets/quarkus-bridge-portlet/docroot/WEB-INF/src/portos/nextmind/quarkus/bridge/scheduler/QuarkusBridgeScheduler.java

@ -18,6 +18,8 @@ import com.liferay.portal.model.Company;
import com.liferay.portal.model.User;
import com.liferay.portal.service.CompanyLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.model.ExpandoColumnConstants;
import it.tref.liferay.portos.bo.model.Comune;
import it.tref.liferay.portos.bo.model.DettPratica;
@ -113,6 +115,38 @@ public class QuarkusBridgeScheduler implements MessageListener {
DettPratica dettPratica = DettPraticaLocalServiceUtil
.addDettPratica(territorioId, tipoProcedura, serviceContext);
// Add custom fields to IntPratica to fetch future updates from Kafka
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(dettPratica.getIntPraticaId());
ExpandoBridge customFieldsExpando = intPratica.getExpandoBridge();
customFieldsExpando.addAttribute(QuarkusBridgeConstants.instanceId,
ExpandoColumnConstants.STRING);
customFieldsExpando.addAttribute(QuarkusBridgeConstants.correlationId,
ExpandoColumnConstants.STRING);
customFieldsExpando.addAttribute(QuarkusBridgeConstants.clientId,
ExpandoColumnConstants.STRING);
customFieldsExpando.addAttribute("HeaderSportelloId", ExpandoColumnConstants.LONG);
customFieldsExpando.addAttribute("SportelloId", ExpandoColumnConstants.LONG);
String instanceId = Header.getString(QuarkusBridgeConstants.instanceId);
String correlationId = Header.getString(QuarkusBridgeConstants.correlationId);
String clientId = Header.getString(QuarkusBridgeConstants.clientId);
Long headerSportelloId = Header.getLong(QuarkusBridgeConstants.recordId);
Long sportelloId = Sportello.getLong(QuarkusBridgeConstants.recordId);
customFieldsExpando.setAttribute(QuarkusBridgeConstants.correlationId, correlationId);
customFieldsExpando.setAttribute(QuarkusBridgeConstants.instanceId, instanceId);
customFieldsExpando.setAttribute(QuarkusBridgeConstants.clientId, clientId);
customFieldsExpando.setAttribute("HeaderSportelloId", headerSportelloId);
customFieldsExpando.setAttribute("SportelloId", sportelloId);
intPratica.setExpandoBridgeAttributes(customFieldsExpando);
// Persist changes to custom fields
IntPraticaLocalServiceUtil.updateIntPratica(intPratica);
} catch (SystemException e) {
_log.error(e ,e);
} catch (PortalException e) {

Caricamento…
Annulla
Salva