23 nov 2012

Showing first tab always in a ADF panelTabbed

Oracle ADF panelTabbed component has the capability of remember the last Tab that the user keeps opened.

When the user get back to the page or taskflow that contains the af:panelTabbed, the last tab opened will be shown instead of the first tab.

If you want to show always first tab as "opened", there is a couple of parameters at the af:showDetailItem that will help us.

This  is a sample code that will make the trick:

<af:panelGroupLayout id="pgl1" layout="vertical">
  <af:panelTabbed id="ptab1" position="above">
    <af:showDetailItem text="First" id="sdi1" persist="disclosed" disclosed="true"/>
    <af:showDetailItem text="Second" id="sdi2" persist="disclosed" disclosed="false"/>
    <af:showDetailItem text="Third" id="sdi3" persist="disclosed" disclosed="false"/>
  </af:panelTabbed>
</af:panelGroupLayout>  


 Check ADF Tag Library

Big thanks to my co worker María for finding the solution :-)

Download sample project

26 oct 2012

Validate check-in form fields with Javascript

At one of my current projects we faced the problem that the dDocName field was filled with no common characters by the user.

For example they insert spaces and letters (like áéíóú). This kind of contentID was breaking the indexer process of UCM.

Most of you will tell me to use the AUTO_NUMBER property of content server, but on some type of content, the user have to insert a specified dDocName for our SSXA Web project.

To prevent contentID like "BIOGRAFÍA CATALÁN", we developed a custom component that performs a JS validation before check-in process.

For the validation I've created a REGEX expresion that allows only letters, numbers and underscore.

This is the code inserted in the custom-component. As you see, this will "include" all system validations with the <$include super.custom_schema_validation_script_post$> sentence.
After that, starts our custom validation, we only have to return "false" if we want to cancel the check-in process.

<@dynamichtml custom_schema_validation_script_post@>
<$include super.custom_schema_validation_script_post$>
<$if ((dpAction like "CheckinSel" or dpAction like "CheckinNew" or dpAction like "Update"))$>
if (document.Checkin != null && document.Checkin.dDocName != null)
{
var name = document.Checkin.dDocName.value;
if(name != null && name != '' && name.length > 0)
{
 var rgx_docname = /^[A-Za-z0-9_]{1,30}$/;
 
 if (rgx_docname.test(name))
 {
  vstatus = "Ok";
 }
 else
 {
  vstatus = "Error";
  alert("Error: You cannot use non-ASCII characters for ContentID");
  return false;
 }
}
}
<$endif$>   
<@end@>

Download here the custom-component for your customization and use.

25 sept 2012

Using WebCenter REST API from Java

Most WebCenter services are available over REST access. In this example app we will try to connect to our development Spaces instance and get the list of spaces for the user.

The REST API supports two kind of different authentication, depending where you use the Java code. If you are creating a taskflow to be deployed on same domain of the spaces node, you should use "OIT" auth, this kind of auth does not need the user password on each request to the server.

Instead, if your code is outside of the weblogic domain, you must send (user + password) on each request.

This sample app have a boolean flag to enable "development-mode" that means connection from outside of weblogic domain (for example my local JDeveloper).

Keep in mind that on each request you should have the URL access to your REST API, to generate that URL you need before the userToken.

//Get the client connnection
RESTUtils rest = new RESTUtils();
rest.setDevelopmentMode(true);

//Get weblogic user token
String userToken = rest.getUserToken();

//Creation of endpoint URL
//Sample URL: http://owc:8888/rest/api/spaces?utoken=FMgUQjBKZ96NGgwGdlZrX-WJACJ4_w**
URL endpoint = new URL(RESOURCE_INDEX + UTOKEN + userToken);

//Establishing connection
HttpURLConnection connection = rest.getConnection(endpoint);

This is the sample output of the app after executing the class WCSpaces.java

5-sep-2012 10:34:33 webcenter.rest.RESTUtils getUserToken
INFO: Obtaining user token
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: We are connecting in development mode
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: Auth sent:Basic d2VibG9naWM6T3JhY2xlMTFn
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: Finished development connection to http://owc:8888/rest/api/resourceIndex
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getUserToken
INFO: Obtained token:FMgUQjBKZ96NGgwGdlZrX-WJACJ4_w**
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: We are connecting in development mode
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: Auth sent:Basic d2VibG9naWM6T3JhY2xlMTFn
25-sep-2012 10:34:33 webcenter.rest.RESTUtils getConnection
INFO: Finished development connection to http://owc:8888/rest/api/spaces?utoken=FMgUQjBKZ96NGgwGdlZrX-WJACJ4_w**
25-sep-2012 10:34:33 webcenter.rest.WCSpaces getSpaces
INFO: Space displayName:blog
25-sep-2012 10:34:33 webcenter.rest.WCSpaces getSpaces
INFO: Space displayName:test
Process exited with exit code 0.



As you see, both "displayName" of the spaces are obtained.

Here is the sample app for download.

And finally the Oracle Documentation about REST

11 sept 2012

Disable component resizing in Oracle Composer

When using Oracle Composer sometimes apper an icon under componentes that allows resizing in runtime.

Check this image






As you see, appears an icon at the botton-right of the component with an appaerance of a triangle. This icon/behaviour can be disabled editing TaskFlow properties and disabling the option.


This action should be performed every time we add a new TaskFlow so is quite annoying.

To disable all resizing behaviour in our portal we have to modify our adf-config.xml file including this lines

  <customizableComponentsSecurity xmlns="http://xmlns.oracle.com/adf/faces/customizable/config">
    <enableSecurity value="true"/>
    <actionsCategory>
      <actionCategory name="personalizeActionsCategory" value="true"></actionCategory>
      <actionCategory name="editActionsCategory" value="true"/>
      <actions>
        <action name="showResizer" value="false"/>
      </actions>
    </actionsCategory>
  </customizableComponentsSecurity>

After this modification, the components won't show the "resize" icon any more.


Sources: Oracle Documentation


1 ago 2012

Configuración REST para WebCenter Spaces (PS3, PS4)

WebCenter Spaces incluye una API REST para consumir sus servicios, esta API es necesaria para alguno de los siguientes casos:

  • Utilizar la aplicación de iPhone / iPad
  • Utilizar datos de Spaces desde una aplicación WebCenter Portal
  • Subir recursos a Spaces (PageTemplate, Content Presenter Templates, etc...)

Para mi ejemplo voy a configurar mi máquina virtual (owc) para que permita este tipo de conexiones.

Es importante indicar que esto solo es necesario en WebCenter PS3 y PS4, en la nueva PS5 ya viene configurado de serie.

Probamos a conectar a la siguiente URL:

  • http://<host>:<port>/rest/api/resourceIndex
En mi caso: http://owc1:8888/rest/api/resourceIndex





Como se puede observar no tenemos acceso, realizaremos los pasos que incluye la documentación oficial, que consiste en:
  • Configurar Identity Asserter
  • Configurar el servidor de almacenes de credenciales.

Pasos a seguir


1.- Creamos el keystore

cd /oracle/jdk/bin (cualquier directorio Java)

./keytool -genkeypair -keyalg RSA -dname "cn=spaces,dc=oracle,dc=com" -alias orakey -keypass welcome1 -keystore /home/oracle/default-keystore.jks -storepass welcome1 -validity 1064

./keytool -exportcert -v -alias orakey -keystore /home/oracle/default-keystore.jks -storepass welcome1 -rfc -file /home/oracle/orakey.cer

./keytool -importcert -alias webcenter_spaces_ws -file /home/oracle/orakey.cer -keystore /home/oracle/default-keystore.jks -storepass welcome1

./keytool -importcert -alias df_orakey_public -file /home/oracle/orakey.cer -keystore /home/oracle/default-keystore.jks -storepass welcome1

2.- Lo copiamos a (Todos los manejados)

cp /home/oracle/default-keystore.jks /oracle/middleware/user_projects/domains/dev_domain/config/fmwconfig

scp /home/oracle/default-keystore.jks oracle@owc2:/oracle/middleware/user_projects/domains/dev_domain/config/fmwconfig/

vi /oracle/middleware/user_projects/domains/dev_domain/config/fmwconfig/jps-config.xml

Añadimos:

<propertySet name="trust.provider.embedded">
<property value="oracle.security.jps.internal.trust.provider.embedded.EmbeddedProviderImpl" name="trust.provider.className"/>
<property value="60" name="trust.clockSkew"/>
<property value="1800" name="trust.token.validityPeriod"/>
<property value="false" name="trust.token.includeCertificate"/>
<property value="orakey" name="trust.aliasName"/>
<property value="orakey" name="trust.issuerName"/>
</propertySet>





3.- Configuro el JKS a través de wlst.sh

/oracle/middleware/Oracle_WC1/common/bin/wlst.sh

connect('weblogic','Oracle11g','t3://owc1:7001')
updateCred(map="oracle.wsm.security", key="keystore-csf-key", user="owsm", password="welcome1", desc="Keystore key")

updateCred(map="oracle.wsm.security", key="enc-csf-key", user="orakey", password="welcome1", desc="Encryption key")

updateCred(map="oracle.wsm.security", key="sign-csf-key", user="orakey", password="welcome1", desc="Signing key")

disconnect()

exit()





4.- Reiniciamos los servidores

Reiniciamos todos los servidores manejados.

5.- Configuramos WLS Trust Service Asserter


  1. Accedemos a la consola de WLS
  2. Navegamos a Security Realms -> myrealm
  3. Nuevo proveedor de autenticación
  4. Nombre del "asserter" (por ejemplo, TrustServiceIdAsserter).
  5. Seleccionamos TrustServiceIdentityAsserter como tipo.
  6. Activar cambios




6.- Configuramos a través de WLST

/oracle/middleware/Oracle_WC1/common/bin/wlst.sh

connect('weblogic','Oracle11g','t3://owc1:7001')

createCred(map="o.webcenter.jf.csf.map", key="keygen.algorithm", user="keygen.algorithm", password="AES")

createCred(map="o.webcenter.jf.csf.map", key="cipher.transformation", user="cipher.transformation", password="AES/CBC/PKCS5Padding")

disconnect()
exit()



7.- Reiniciamos los servidores

Reiniciamos los nodos manejados



Por último, accedo a: http://owc1:8888/rest/api/resourceIndex y vemos el resultado obtenido



Fuentes de información:

28 jun 2012

Performance of Fusion Middleware

I've just saw a great post from Daniel Mortimer grouping a recopilation of tunning and performance tips on FMW applications.

Check out this note at Metalink (link)

12 jun 2012

Installing Weblogic 10.3.6 in command line mode

A couple of days ago I was installing a WLS PS5 for a WebCenter Content installation. Im using linux 64bit version and found an annoying bug.

If you start the installation in GUI mode, the wizard will ask you for the oracle support mail and password. I tried several times to skip that step, but the installation does not allow any action to bypass it.

So my last chance, was the installation by command line, these are the steps of the complete process:

[oracle@owc WLS]$ java -d64 -jar wls1036_generic.jar -mode=console
Extracting 0%....................................................................................................100%





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Welcome:
--------

This installer will guide you through the installation of WebLogic 10.3.6.0.
Type "Next" or enter to proceed to the next prompt.  If you want to change data entered previously, type "Previous".  You may quit the installer at any time by typing "Exit".




Enter [Exit][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Choose Middleware Home Directory:
---------------------------------

    "Middleware Home" = [Enter new value or use default
"/home/oracle/Oracle/Middleware"]




Enter new Middleware Home OR [Exit][Previous][Next]> /oracle/middleware





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Choose Middleware Home Directory:
---------------------------------

    "Middleware Home" = [/oracle/middleware]

Use above value or select another option:
    1 - Enter new Middleware Home
    2 - Change to default [/home/oracle/Oracle/Middleware]




Enter option number to select OR [Exit][Previous][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

   1|Email:[]
   2|Support Password:[]
   3|Receive Security Update:[Yes]



Enter index number to select OR [Exit][Previous][Next]> 3





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

    "Receive Security Update:" = [Enter new value or use default "Yes"]



Enter [Yes][No]? No





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

    "Receive Security Update:" = [Enter new value or use default "Yes"]


    ** Do you wish to bypass initiation of the configuration manager and
    **  remain uninformed of critical security issues in your configuration?


Enter [Yes][No]? Yes





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

   1|Email:[]
   2|Support Password:[]
   3|Receive Security Update:[No]



Enter index number to select OR [Exit][Previous][Next]>




<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

   1|Email:[]
   2|Support Password:[]
   3|Receive Security Update:[No]



Enter index number to select OR [Exit][Previous][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Choose Install Type:
--------------------

Select the type of installation you wish to perform.

 ->1|Typical
    |  Install the following product(s) and component(s):
    | - WebLogic Server
    | - Oracle Coherence

   2|Custom
    |  Choose software products and components to install and perform optional
    |configuration.





Enter index number to select OR [Exit][Previous][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

JDK Selection (Any * indicates Oracle Supplied VM):
---------------------------------------------------

JDK(s) chosen will be installed.  Defaults will be used in script string-substitution if installed.

   1|Add Local Jdk
   2|/oracle/jrockit[x]



   *Estimated size of installation:  690.2 MB


Enter 1 to add or >= 2 to toggle selection  OR [Exit][Previous][Next]> 2





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

JDK Selection (Any * indicates Oracle Supplied VM):
---------------------------------------------------

JDK(s) chosen will be installed.  Defaults will be used in script string-substitution if installed.

   1|Add Local Jdk
   2|/oracle/jrockit[ ]



   *Estimated size of installation:  690.2 MB


Enter 1 to add or >= 2 to toggle selection  OR [Exit][Previous][Next]> 2





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

JDK Selection (Any * indicates Oracle Supplied VM):
---------------------------------------------------

JDK(s) chosen will be installed.  Defaults will be used in script string-substitution if installed.

   1|Add Local Jdk
   2|/oracle/jrockit[x]



   *Estimated size of installation:  690.2 MB


Enter 1 to add or >= 2 to toggle selection  OR [Exit][Previous][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Choose Product Installation Directories:
----------------------------------------

Middleware Home Directory: [/oracle/middleware]

Product Installation Directories:


   1|WebLogic Server: [/oracle/middleware/wlserver_10.3]
   2|Oracle Coherence: [/oracle/middleware/coherence_3.7]




Enter index number to select OR [Exit][Previous][Next]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

The following Products and JDKs will be installed:
--------------------------------------------------

    WebLogic Platform 10.3.6.0
    |_____WebLogic Server
    |    |_____Core Application Server
    |    |_____Administration Console
    |    |_____Configuration Wizard and Upgrade Framework
    |    |_____Web 2.0 HTTP Pub-Sub Server
    |    |_____WebLogic SCA
    |    |_____WebLogic JDBC Drivers
    |    |_____Third Party JDBC Drivers
    |    |_____WebLogic Server Clients
    |    |_____WebLogic Web Server Plugins
    |    |_____UDDI and Xquery Support
    |    |_____Evaluation Database
    |_____Oracle Coherence
         |_____Coherence Product Files

    *Estimated size of installation: 690.3 MB




Enter [Exit][Previous][Next]>
May 30, 2012 6:04:16 PM java.util.prefs.FileSystemPreferences$2 run
INFO: Created user preferences directory.





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Installing files..

0%          25%          50%          75%          100%
[------------|------------|------------|------------]
[***************************************************]


Performing String Substitutions...





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Configuring OCM...

0%          25%          50%          75%          100%
[------------|------------|------------|------------]
[***************************************************]


Creating Domains...





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Installation Complete


Congratulations! Installation is complete.


Press [Enter] to continue or type [Exit]>





<-------------------- Oracle Installer - WebLogic 10.3.6.0 ------------------->

Clean up process in progress ...
[oracle@owc WLS]$

11 jun 2012

Instalación de WebCenter en Cluster (parte 2)

Nuestra segunda parte del manual implica extender el dominio para incluir los nodos de WebCenter Content y Portal.

Parte 1 (aquí)

Accedemos a la herramienta de configuración de dominio:
cd /oracle/middleware/oracle_common/common/bin
./config.sh

Extensión del dominio

Selecciono el dominio a extender


Selecciono los productos a añadir


Comprueba los accesos a la BB.DD con los esquemas necesarios (previamente creados a través de rcu)


 Definimos configurar opcionalmente los siguientes parámetros






Creamos la configuración de máquinas UNIX (que no de máquinas)


Especificamos como se repartirán los nodos manejados


Las librerías necesarias para AdminServer, por defecto nos preselecciona más de las necesarias. Este listado muestras las reales:

oracle.bi.jbips(11.1.1,0.1)                
oracle.bi.composer(11.1.1,0.1)                
oracle.bi.adf.model.slib(1.0,11.1.1.2.0)                
oracle.bi.adf.view.slib(1.0,11.1.1.2.0)                
oracle.bi.adf.webcenter.slib(1.0,11.1.1.2.0)                
oracle.wsm.seedpolicies(11.1.1,11.1.1)                
oracle.jsp.next(11.1.1,11.1.1)                
oracle.dconfig-infra(11,11.1.1.1.0)                
orai18n-adf(11,11.1.1.1.0)                
oracle.adf.dconfigbeans(1.0,11.1.1.2.0)                
oracle.pwdgen(11.1.1,11.1.1.2.0)                
oracle.jrf.system.filter                
adf.oracle.domain(1.0,11.1.1.2.0)                
adf.oracle.businesseditor(1.0,11.1.1.2.0)                
oracle.adf.management(1.0,11.1.1.2.0)                
adf.oracle.domain.webapp(1.0,11.1.1.2.0)                
jsf(1.2,1.2.9.0)                
jstl(1.2,1.2.0.1)                
UIX(11,11.1.1.1.0)                
ohw-rcf(5,5.0)                
ohw-uix(5,5.0)                
oracle.adf.desktopintegration.model(1.0,11.1.1.2.0)                
oracle.adf.desktopintegration(1.0,11.1.1.2.0)                
oracle.webcenter.skin(11.1.1,11.1.1)                
oracle.bpm.mgmt(11.1.1,11.1.1)                
emai                
oracle.webcenter.composer(11.1.1,11.1.1)                
emas                
emcore  
 


La librería JOC sólo se especifica en los clústeres



Ahora ya tenemos finalizado la extensión del dominio.

Desactivando la verificación de HostName

Accedemos a la consola de Weblogic y vamos a la siguiente página: Entorno > Servidores.

Por cada servidor accedemos a sus propiedades y en la pestaña SSL en la zona de "avanzado" y desactivamos la verificación de host.


Realizamos esta operación en todos los nodos manejados que existan.

Empaquetando la configuración y exportandola al nodo 2 

Ahora utilizamos el siguiente comando para empaquetar la configuración del servidor:

OWC1> cd ORACLE_COMMON_HOME/common/bin

OWC1> ./pack.sh -managed=true -domain=/oracle/middleware/user_projects/domains/dev_domain -template=edgdomaintemplate.jar -template_name=edgdomain_template

copiamos el fichero edgdomaintemplate.jar al nodo 2 (OWC2) y procedemos a su descompresión:

OWC2> cd ORACLE_COMMON_HOME/common/bin

OWC2> ./unpack.sh -domain=/oracle/middleware/user_projects/domains/dev_domain -template=edgdomaintemplate.jar -app_dir=/oracle/middleware/user_projects/applications/dev_domain

Arrancando NodeManager en el nodo 2 (OWC2)

OWC2> cd ORACLE_COMMON_HOME/common/bin 
OWC2> ./setNMProps.sh
OWC2> cd WL_HOME/server/bin 
OWC2> ./startNodeManager.sh

Arrancando los nodos manejados

Vamos a la parte de servidores y seleccionamos uno de los nodos manejados e iniciamos su arranque.


Revisamos las trazas del proceso de arranque para verificar que el arranque ha sido correcto.

Fuentes empleadas:

En próximas entradas haremos ejemplos de scripts de arranque para los procesos de weblogic durante el arranque del sistema.

Saludos!

20 abr 2012

Show any image rendition in a Content Presenter Template

One of the common questions when a developer is creating a template for the WebCenter Content Presenter is


"How can I show the thumbnail of the image?" or "How can I obtain xxxx rendition?", Is quite simple, but I believe that is not documented.


This is a sample for a thumbnail:


<af:image source="#{WCAppContext.applicationURL}/content/conn/UCM/uuid/dDocName%3a#{node.propertyMap['dDocName'].value.stringValue}?rendition=thumbnail"
id="i1"/>

Where "UCM" is the name of your content connection inside the WebCenter Portal application.

I hope this helps you on your templates development.


14 mar 2012

Add SecurityGroup from parent folder in a profile check-in

Using folders component in WebCenter Content, let you to add default or inherit metadata to the contents that are under the parent folder.

Imagine that you have 3 different folders for a "news" content, two of them with "Public" SecurityGroup but the last one with "Secure" SecurityGroup.

Usually you will create only one profile, so users will select the folder during check-in process (if they can see them) and depending of the folder, the metadata dSecurityGroup will be filled.


Here are the steps to achieve this:

Modify "Folders" View

  1. Log into Configuration Manager Applet

  2. Go to "Tables" tab, and select "Collections" table.

  3. Click on "Edit Table", if you cannot see the columns, click on "syncrhonize definition" close again the windows and try again (sometimes it tooks a while until the columns information appears)

  4. Now move to "View" Tab and Edit the "Folders" View.

  5. Edit it and select the "Change Columns" to include the dSecurityGroup



  6. Move to the "Security" Tab and check the option "Publish view data".


Creating the Rule

  1. Create a new rule and check it as "global"

  2. Go to fields, and add "Security Group"



  3. Edit "Derived field information" and in custom tab add this code:




<$nuevoValor=getViewValue("Folders",#active.xCollectionID,"dSecurityGroup")$>
<$if nuevoValor$>
<$dpPromote("dSecurityGroup",nuevoValor)$>
<$endif$>


Few things to remember

If the metadata from the parent that you want to "derive" is custom (like xDepartment) you should create a view from table "COLMETA" with the columns dCollectionID and xDepartment, for more info check on metalink this note: 780979.1