Skip to content

Instantly share code, notes, and snippets.

View CedricL46's full-sized avatar

Cedric L CedricL46

View GitHub Profile
/**
* Apply view criteria named MyViewCriteria to it's ViewObject
* by getting it through the binding iterator MyViewObjectIterator
* Full library : https://github.com/CedricL46/Oracle-ADF-and-JSF-Utils-libraries
*/
public void applyViewCriteriaOnViewObjectByIteratorName(String MyViewCriteriaName, String MyViewObjectIteratorName) {
try {
//Get The viewObject from the iterator define in the current binding context
ViewObject vo = this.getViewObjectFromIteratorName(MyViewObjectIteratorName)
//Get all it's ViewCriteria using the ViewCriteriaManager of the ViewObject
public String defaultNextStatus() {
String value = (String) getAttributeInternal(AttributesEnum.NextStatus.index());
if (value == null) {
XxcrWorkflowUvVORowImpl nextStatut = (XxcrWorkflowUvVORowImpl) getWfkVA().first();
//Wkfva is the VO of the LOV
if (nextStatut != null) {
return nextStatut.getTxtValeur();
}
}
return value;
@CedricL46
CedricL46 / forwardAfterLogic.java
Created February 20, 2018 08:04
How to fix a java.lang.IllegalStateException: Cannot forward a response that is already committed on a jsf action with sendRedirect/forward in ADF
//ADF : jsf :
<h:commandButton id="myBtnId"
action="#{myBean.doLogic}"
value="click me"
type="submit"
actionListener="#{myBean.forwardAfterLogic}"/>
//ADF : myBean :
#Install git and upgrade all packages
sudo yum update -y
sudo yum install git
#Get last available version of let's encrypt
git clone https://github.com/letsencrypt/letsencrypt.git
#result :
Cloning into 'letsencrypt'...
remote: Counting objects: 55232, done.
remote: Compressing objects: 100% (55/55), done.
#Initialize your project folder using npm
ubuntu@YourComputer:~/FbJokeBot$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
/**
* Unapply a view criteria named MyViewCriteria to it's ViewObject
* by getting it through the binding iterator MyViewObjectIterator
* Full library: https://github.com/CedricL46/Oracle-ADF-and-JSF-Utils-libraries
*/
public void UnApplyViewCriteriaOnViewObjectByIteratorName(String MyViewCriteriaName, String MyViewObjectIteratorName) {
try {
//Get The viewObject from the iterator define in the current binding context
ViewObject vo = this.getViewObjectFromIteratorName(MyViewObjectIteratorName)
//Get all it's ViewCriteria using the ViewCriteriaManager of the ViewObject
@CedricL46
CedricL46 / addBusyStateListenerPopUp.html
Last active April 12, 2018 13:31
How to display a please wait message when the server is processing using addBusyStateListener in ADF ? https://cedricleruth.com/how-to-display-a-please-wait-message-when-the-server-is-processing-using-addbusystatelistener-in-adf/
<af:group id="pt_g3">
<div id="loaderId"></div>
<af:popup id="processingP" contentDelivery="immediate" clientComponent="true">
<af:dialog id="d2" title="Processing..." type="none" closeIconVisible="false" inlineStyle="text-align:center;" clientComponent="true"
modal="true">
<f:facet name="buttonBar"/>
<af:panelGroupLayout id="pgl2" layout="vertical" halign="center">
<af:spacer width="10" height="10" id="s11"/>
<af:outputText value="Please wait..." id="ot2669"/>
</af:panelGroupLayout>
@CedricL46
CedricL46 / warnAndPreventUserInputADF.js
Last active April 12, 2018 13:31
How to display a please wait message when the server is processing using addBusyStateListener in ADF ? https://cedricleruth.com/how-to-display-a-please-wait-message-when-the-server-is-processing-using-addbusystatelistener-in-adf/
var popup = null;
var clickedElem = null;
function triggerOnLoad(event) {
//You can either set the popup using the pure html div id (recommended)
popup = AdfPage.PAGE.findComponentByAbsoluteId(document.getElementById('loaderId').nextSibling.id);
//or set the popup knowing the full id of your popup for example :
//popup = AdfPage.PAGE.findComponentByAbsoluteId('p1:processingP');
//popup = AdfPage.PAGE.findComponent('processingP');
return true;
ubuntu@ip-YourComputer:~/FbJokeBot$ claudia update --configure-fb-bot
updating REST API apigateway.createResource parentId=parentId pathPart=facebook restApiId=0s7tsgupdating REST API apigateway.createResource parentId=parentId pathPart=telegram restApiId=0s7tsgupdating REST API apigateway.createResource parentId=parentId pathPart=groupme restApiId=0s7tsgrate-limited by AWS, waiting before retry apigateway.setAcceptHeader
Facebook Messenger setup
Following info is required for the setup, for more info check the documentation.
const botBuilder = require("claudia-bot-builder");
const fbTemplate = botBuilder.fbTemplate;
//to install run 'npm i sync-request' in the project folder terminal
var request = require("sync-request");
//to install run 'npm i keyword-extractor' in the project folder terminal
var keywordExtractor = require("keyword-extractor");
//function to query the really nice icanhazdadjoke API for a joke
function getJoke(keyword) {