Monday, August 13, 2018

Migrate an Enterprise Capture Workspace


This can be accomplished by using the WLST commands "exportWorkspace" on the source Enterprise Capture system and "importWorkspace" on the target Enterprise Capture system.

The exact steps are :

1) Run the wlst command (.sh for Linux, .cmd for Windows) from the Middleware home /common/bin directory:

  wlst.sh

2) Connect to the Capture managed server:

    wls:/offline> connect("weblogic","welcome1","t3://localhost:16400")

3) Retrieve Workspace ID, which is passed to the export command.  To get a list of current workspaces and their IDs:

    wls:/content/serverConfig>listWorkspaces()

The list will look like the following:

         8 wkspace1

         6 fred-wk2

         7 test-capture1

4) Run the export command:

    wls:/content/serverConfig>exportWorkspace(8,'/home/isyed/wkspace1.xml')

5) Import the workspace to the same instance (only if you deleted the workspace since exporting) or a different Capture instance:

   wls:/content/serverConfig>importWorkspace('/home/isyed/wkspace1.xml')


Sunday, August 12, 2018

Multiple eclipse instances on Mac

OSX Eclipse Launcher utility plugin

Follow these simple instructions
  1. Go to help --> Eclipse Marketplace...
  2. Search for "OS X Eclipse laucher utility"
  3. Cick Install, Next, Finish and restart your eclipse.
Once the plugin is installed, click on File --> Open Workspace.  Here you go, a new instance of eclipse is opened with a new workspace.

Thursday, July 12, 2018

Advance Scripts for Oracle WebCenter Capture

More documentation can be found here: https://docs.oracle.com/cd/E29542_01/doc.1111/e28275/c01_intro.htm

Script to generate the logs:

----------------------------------------------------------------------------------------------
load("nashorn:mozilla_compat.js");

function logRPCEvent (rpc, funcName) {
var logger = rpc.getLogger();
logger.info("PrintRecogProcEvents.js entered function: " + funcName);
}

function initialize(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "initialize");
}

function processBatch(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "processBatch");
}

function restoreCaptureBatch(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "restoreCaptureBatch");
}

function beginPhase(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "beginPhase");
}

function endPhase(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "endPhase");
}

function extractBatchItem(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "extractBatchItem");
}

function barcodesFoundOnItem(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "barcodesFoundOnItem");
}

function batchItemAllValidBarcodes(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "batchItemAllValidBarcodes");
}

function determineSeparatorPage(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "determineSeparatorPage");
}

function batchItemValidBarcode(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "batchItemValidBarcode");
}

function determineDocType(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "determineDocType");
}

function beginDatabaseLookup(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "beginDatabaseLookup");
}

function determineIndexValues(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "determineIndexValues");
}

function renameOrigCaptureDocTitle(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "renameOrigCaptureDocTitle");
}

function createCaptureDoc(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "createCaptureDoc");
}

function postProcess(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "postProcess");
}

function endBatchProcess(rpc) { // RecognitionProcessorContext
logRPCEvent(rpc, "endBatchProcess");
}
----------------------------------------------------------------------------------------------

Script to Update the Date format 

----------------------------------------------------------------------------------------------
load("nashorn:mozilla_compat.js");
importClass(java.text.SimpleDateFormat);
importClass(java.util.Date);

function logRPCEvent(rpc, logText) {
    var logger = rpc.getLogger();
    logger.info("[WWW] - " + logText);
}

function determineIndexValues(rpc) { // RecognitionProcessorContext
    logRPCEvent(rpc, "determineIndexValues");
    convertDateFormat(rpc);
}



function convertDateFormat(rpc) {
    logRPCEvent(rpc, "convertDateFormat");
    var DOCUMENT_DATE_FIELD = "Document Date";

    var documentDate = getIndexID(rpc, DOCUMENT_DATE_FIELD);
    logRPCEvent(rpc, "Get Index Field Id: " + documentDate);

    var capturedDocument = rpc.getBle().getBatch().getDocuments().get(0);
    logRPCEvent(rpc, "Captured Document : " + capturedDocument);

    var indexValues = rpc.getDocument().getIndexValues();
    for (var i = 0; i < indexValues.size(); i++) {
        var iv = indexValues.get(i);
        if (iv.getFieldID().equals(documentDate)) {
            logRPCEvent(rpc, "FieldID: [" + iv.getFieldID() + "] FieldValue: [" + iv.getFieldValue() + "]");
            var documentDateCapturedValue = iv.getFieldValue();
            iv.setFieldValue(formatRequiredDate(documentDateCapturedValue));
        }
    }
}

// @Format the date to yyyy-MM-dd'T'HH:mm:ss'Z'
function formatRequiredDate(currentDate) {

    var REQUIRED_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
    var LOOKUP_DATE_PATTERN = "MM-dd-yyyy";
    var currentDateFormat = new SimpleDateFormat(LOOKUP_DATE_PATTERN);
    var inputDate = currentDateFormat.parse(currentDate);
    currentDateFormat.applyPattern(REQUIRED_PATTERN);

    return currentDateFormat.format(inputDate);
}

// @Return the field object from document
function getFieldDefination(document, field) {
    return document.getParentBatch().getWorkspace().getFieldDefinitions().findByName(field);
}

// @Get the index Id
function getIndexID(rpc, indexName) {
    var workspace = rpc.getWorkspaceEntity();
    var indexDef = findIndexDefinitionByName(workspace, indexName, rpc);

    if (indexDef != null) {
        var indexID = indexDef.getIndexFieldID();
    }
    logRPCEvent(rpc, " In getIndexID : indexID [" + indexID + "]");
    return indexID;
}

// @Get the index definition by name
function findIndexDefinitionByName(workspace, indexName, rpc) {
    logRPCEvent(rpc, " In findIndexDefinitionByName : Workspace [" + workspace + "], Index Name: [" + indexName + "]");
    var indexDefs = workspace.getIndexDefinitions();
    var size = indexDefs.size();
    var foundIndexDef = null;
    for (var i = 0; i < size; i++) {
        var indexDef = indexDefs.get(i);
        if (indexName.equals(indexDef.getFieldName())) {
            foundIndexDef = indexDef;
            break;
        }
    }
    logRPCEvent(rpc, " In findIndexDefinitionByName : foundIndexDef [" + foundIndexDef + "]");
    return foundIndexDef;
}
----------------------------------------------------------------------------------------------

Steps to configure in Capture:


  1. Copy the following code to a text file.
  2. Open the WebCenter Workspace Console.
  3. Select the desired Workspace.
  4. Select the "Advanced" train stop / tab.
  5. Click the "Add New Script" button.
  6. Select type "Recognition Processor" and name the script appropriately. For example, LogsRecProcEvents.
  7. Select the file created above and click submit.
  8. Select the "Processing" tab.
  9. Select the desired Recognition Processor job and click the Edit (pencil) icon.
  10. Go to the "Extensions" train stop / tab.
  11. Click the "Script" pulldown menu.
  12. Select the script created in the Advanced Tab, (e.g. LogsRecProcEvents).
  13. Click "Submit" to apply the script.



Welcome to Vagrant

1. Download and Install the Vagrant  - (https://www.vagrantup.com/downloads.html)
i. Check the vagrant installed version: vagrant -vagrant
ii. Check the OS path if you can find the vagrant command.

2. Download and Install the Oracle Virtual Box - (https://www.virtualbox.org/wiki/Downloads)

3. Create a new folder for Vagrant box instances - vagrant-boxes

4. Get the required box name from the vagrant catalog - https://app.vagrantup.com/boxes/search

5. Go to the newly created folder (vagrant-boxes) and run command to create the vagrant instance.
- vagrant init ubuntu/trusty64
        i.  ubuntu/trusty64 is the vagrant box available in the catalog.
       ii. You get the following error:
                  The box 'xxxxxx' could not be found or could not be accessed in the remote catalog.
Use the following command to download the vagrant intance
- vagrant box add ubuntu/trusty64 https://app.vagrantup.com/ubuntu/boxes/trusty64


6. The vagrant will create an instance configuration file (VagranFile). Review the file and update the configuration only if you are sure what you are doing.

7.  Run the command to up the vagrant instance, the command will download the instance and make it ready to use.
   - vagrant up
   i.e Just make sure you are on the right path/directory.

   - vagrant destroy : to delete the vagrant instance
   - vagrant suspend : to shutdown the vagrant instance
   - vanrant resume  : to started the suspended instance
   - bagramt reload  : to reload the instance incase of change in vm configuration.

8.  The VM system specification(RAM, Processor, Hard drive) can be updated in vagrantfile (the configuration file which created in step#5)
#Provider Settings
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vm.cpus = 4
end

- vagrant reload
   The specification can be updated through the oracle box. ??!! (Need to verify)

9.  SSH the box through vagrant command and continue with setuping other apps (apache, mysql, etc) on box.
- vagrant ssh

10. Enable the network settings in vagrantfile (the configuration file which created in step#5)

#Network Settings
config.vm.network "forwarded_port", guest: 80, host: 8080
#If wanted to use private network ip then above statment must be commited
config.vm.network "private_network", ip: "192.168.10.10"

    - vagrant reload

11. Add hostname/domain name on the local environment, it's completely based on OS like in Linux: \etc\hosts
        192.168.10.10 mybox.local www.mybox.local

12. Setup share folder in vagrantfile (the configuration file which created in step#5)

#Folder Settings
config.vm.synced_folder ".", "/vagrant_data", mount_options =>["dmode=777","fmode=666"]
# . is a current folder of host OS and it can be different path like /home/isyed/Downloads
# "/vagrant_data" is destination folder and it can also be any file path in gest os.
# mount_options =>["dmode=777","fmode=666"]  are the permission on the folder to make it more secure
# Check NFS with Vagrant to increase the performance for network shared folders - :nfs => { :mount_options =>["dmode=777","fmode=666"]}
   config.vm.synced_folder ".", "/vagrant_data", :nfs => { :mount_options =>["dmode=777","fmode=666"]}

- vagrant reload

13. Setup a provision Settings : You can add the list of command which is going to be executed by vagrant once the instance is recreated.

#Provision Settings
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y apache2
SHELL

The provision command can be stored in different provision file, to do so update the provision settings:
#Provision Settings
config.vm.provision "shell", path:"bootstrap.sh"

Add new file bootstrap.sh file and add the all the commands which you need to execute after the instance is up.

Vagrantfile

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Vagrant.configure("2") do |config|
  
  config.vm.box = "ubuntu/trusty64"

  # config.vm.box_check_update = false
  # config.vm.network "forwarded_port", guest: 80, host: 8080
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # config.vm.network "private_network", ip: "192.168.0.8"
  # config.vm.network "public_network"
  # config.vm.synced_folder "../data", "/vagrant_data"
    
   # config.vm.hostname = "vlamp"
   # config.ssh.username = "vlamp"

   # config.vm.network "public_network", bridge:"en0: Wi-Fi (AirPort)", ip: "192.168.0.120”

   config.vm.network "public_network", :bridge => "eth0", ip: "192.168.0.180", :netmask => "255.255.255.128", auto_config: false

   # config.vm.network "public_network", use_dhcp_assigned_default_route: true
   # Attempt to 'guess' the default network
   # config.vm.network :public_network, :bridge => 'en0: Wi-Fi (AirPort)'

   config.vm.provider "virtualbox" do |vb|
     
     # Set Instance Name
     vb.name = "vlamp"
     # Display the VirtualBox GUI when booting the machine
     vb.gui = false
  
     # Customize the amount of memory on the VM:
      vb.memory = "1024"
   end

   config.vm.provision "shell", inline: <<-SHELL
     apt-get update
     #apt-get install -y apache2
   SHELL

end

--------------------------------------------------------------------------------------------------------------------------

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  # config.vm.box_check_update = false
  # config.vm.network "forwarded_port", guest: 80, host: 8080
    config.vm.network "private_network", ip: "192.168.10.10"
  # config.vm.network "public_network"

   config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
   config.vm.provider "virtualbox" do |vb|
     vb.gui = false
vb.name = "coremedia9"
vb.cpus = 4
     vb.memory = "1024"
   end
 
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL

end

--------------------------------------------------------------------------------------------------------------------------
 



Saturday, July 7, 2018

Disable 8dot3


Disable 8dot3 naming, what is requested during UCM install procedure, by running "Installer DisableNtfs8dot3" and then restarting windows. This procedure can be run after UCM installation is done.

Run: DomainHome\ucm\cs\bin\Installer.exe DisableNtfs8dot3
Page 153: http://download.oracle.com/docs/cd/E17904_01/doc.1111/e14495.pdf

If that still leaves 8dot3 naming enabled, modify registry:
1. Start/Run/regedit
2. In the left pane of the window navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
3. In the right pane of the window, edit the DWORD "NtfsDisable8dot3NameCreation" and set its value to 1 (The default value is 2)
4. Reboot the system

RCU-6080:Global prerequisite check failed

RCU-6080:Global prerequisite check failed – The selected Oracle database is a multitenant container database (CDB).


Steps : 

1) Check where are your PDB installed

SQL> select name from v$services;
NAME
—————————————————————-
pdborcl
weblogicXDB
weblogic
SYS$BACKGROUND
SYS$USERS

2. Alter your database:
SQL>  alter pluggable database all open;

3.  insert the correct service name. On my case, is pdborcl:

AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...