Showing posts with label webcenter. Show all posts
Showing posts with label webcenter. Show all posts

Monday, December 12, 2016

Using the IdcCommand Utility to Access Content Server Part2

Pada part1 kita sudah berhasil menjalankan IdcCommand untuk proses Chekc-in dokumen, di part2 ini kita akan coba untuk melakukan add/create user menggunakan IdcCommand.

Prerequisite untuk proses ini sama dengan yang ada di part1, jadi kita cukup menambahkan 1 method lagi untuk proses Add User.

Cukup tambahkan satu method dibawah ini pada class java UcmClient yang sudah kita buat pada part1 sebelumnya.

public String addUser(String dName, String dFullName, String account) {
 ServiceResponse response = null;
 String result = "";
 try {
 // create request
  DataBinder binder = idcClient.createBinder();
  binder.putLocal("IdcService", "ADD_USER");

  // define UserAttributeInfo
  DataObjectImpl dataObject = new DataObjectImpl();
  dataObject.put("dUserName", dName);
  dataObject.put("AttributeInfo", "account," + account);

  DataResultSetImpl userAttribInfo = new DataResultSetImpl();
  userAttribInfo.addField(new DataResultSet.Field("dUserName"), dName);
  userAttribInfo.addField(new DataResultSet.Field
   ("AttributeInfo"), "account," + account);
  userAttribInfo.addRow(dataObject);
  userAttribInfo.addField(new DataResultSet.Field(""), "");

  binder.putLocal("dName", dName);
  binder.putLocal("dUserAuthType", "Local");
  binder.putLocal("dFullName", dFullName);
  binder.putLocal("dPassword", "welcome1");
  binder.addResultSet("UserAttribInfo", userAttribInfo);

  // check in the file
  response = idcClient.sendRequest(userContext, binder);
  result = dName;
  // result = response.getResponseAsString();

  } catch (Exception e) {
   e.getMessage();
  } finally {
   response.close();
  }

  return result;
 }

Maka java lengkapnya akan menjadi seperti berikut

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.model.DataResultSet.Field;
import oracle.stellent.ridc.model.TransferFile;
import oracle.stellent.ridc.model.impl.DataObjectImpl;
import oracle.stellent.ridc.model.impl.DataResultSetImpl;
import oracle.stellent.ridc.protocol.ServiceException;
import oracle.stellent.ridc.protocol.ServiceResponse;
import oracle.stellent.ridc.protocol.intradoc.IntradocClient;

public class UcmClient {

 public static final String idcConnectionUrl = "idc://localhost:4444";
 public static final String sysadmin = "weblogic";
 public static final int socketTimeout = 30000;
 public static final int connectionSize = 20;

 private IntradocClient idcClient;
 private IdcClientManager manager;
 private IdcContext userContext;


 public static void main(String[] args) throws IdcClientException, IOException {
  // TODO Auto-generated method stub
  String dName = "David";
  String dFullName = "Isnin David";
  String account = "IT";
  
  UcmClient main = new UcmClient();
  main.checkInDocument();
  main.addUser(dName, dFullName, account);
 }

 public UcmClient() throws IdcClientException {
  // create the manager
  manager = new IdcClientManager();

  // build a client that will communicate using the intradoc protocol
  idcClient = (IntradocClient) manager.createClient(idcConnectionUrl);

  // get the config object and set properties
  idcClient.getConfig().setSocketTimeout(socketTimeout); // 30 seconds
  idcClient.getConfig().setConnectionSize(connectionSize); // 20

  // create a trusted user context
  userContext = new IdcContext(sysadmin);
 }

 public void checkInDocument() throws IdcClientException, IOException {
  // create request
  DataBinder binder = idcClient.createBinder();
  binder.putLocal("IdcService", "CHECKIN_UNIVERSAL");

  // get the binder
  binder.putLocal("dDocTitle", "Test Checkin Document");
  binder.putLocal("dDocName", "Test Checkin Document Using Java");
  binder.putLocal("dDocType", "Document");
  binder.putLocal("dSecurityGroup", "public");

  // add a file
  binder.addFile("primaryFile", new TransferFile(new File("/Test.docx")));

  // check in the file
  ServiceResponse response = idcClient.sendRequest(userContext, binder);

  DataBinder binderResult = response.getResponseAsBinder();
  Collection resultSetNames = binderResult.getResultSetNames();

  for (String name : resultSetNames) {
   System.out.println(name);
  }
 }

 public String addUser(String dName, String dFullName, String account) {
  ServiceResponse response = null;
  String result = "";
  try {
   // create request
   DataBinder binder = idcClient.createBinder();
   binder.putLocal("IdcService", "ADD_USER");

   // define UserAttributeInfo
   DataObjectImpl dataObject = new DataObjectImpl();
   dataObject.put("dUserName", dName);
   dataObject.put("AttributeInfo", "account," + account);

   DataResultSetImpl userAttribInfo = new DataResultSetImpl();
   userAttribInfo.addField(new DataResultSet.Field
                                        ("dUserName"), dName);
   userAttribInfo.addField(new DataResultSet.Field
     ("AttributeInfo"), "account," + account);
   userAttribInfo.addRow(dataObject);
   userAttribInfo.addField(new DataResultSet.Field(""), "");

   binder.putLocal("dName", dName);
   binder.putLocal("dUserAuthType", "Local");
   binder.putLocal("dFullName", dFullName);
   binder.putLocal("dPassword", "welcome1");
   binder.addResultSet("UserAttribInfo", userAttribInfo);

   // check in the file
   response = idcClient.sendRequest(userContext, binder);
   result = dName;
   // result = response.getResponseAsString();

  } catch (Exception e) {
   e.getMessage();
  } finally {
   response.close();
  }

  return result;
 }
}


Demikian untuk blog kali ini, semoga dapat membantu dan bermanfaat. :)

See you next!

Using the IdcCommand Utility to Access Content Server Part1

Pada kesempatan kali ini saya ingin menulis tentang API Oracle Webcenter Content.

Webcenter Content dimanfaatkan untuk penyimpanan dokumen secara elektornik. Dokumen perlu dijaga agar dapat diakses/dicari dengan mudah jika suatu saat nanti diperlukan. Webcenter Content juga dapat digunakan untuk mengatur masa hidup dokumen mulai dari pembuatan, pencarian, konversi, hinga pemusnahan dokumen apabila diperlukan.

Istilah penyimpanan dokumen dalam Webcenter Content adalah Check-in. Profile dokumen dapat dibuat sesuai dengan jenis dokumen untuk lebih memudahkan dalam pengarsipan. Ada banyak cara untuk melakukan check-in dokumen diantaranya adalah:
  1. Check-in langsung di Document Profile Webcenter Content 
  2. Check-in di Webcenter Portal, apabila Webcenter Portal dan Content sudah ter-integrasi.
  3. Check-in dokumen via API dengan menggunakan Java.
Pada kesempatan kali ini saya ingin coba memberikan contoh penggunaan API Webcenter Content menggunakan Java. Cekidot ya guys..

Persiapan
  1. Saya menggunakan Webcenter Content versi 12.2.1.1.0
  2. lib oracle.ucm.ridc.jar
Implementasi
  1. Buat suatu class java dengan nama UcmClient.java
  2. Buat satu method khusus untuk define connection ke Webcenter Content

  3. public static final String idcConnectionUrl = "idc://localhost:4444";
    public static final String sysadmin = "weblogic";
    public static final int socketTimeout = 30000;
    public static final int connectionSize = 20;
    private IntradocClient idcClient;
    private IdcClientManager manager;
    private IdcContext userContext;
    
    public static void main(String[] args) throws IdcClientException, IOException {
        // TODO Auto-generated method stub
        UcmClient main = new UcmClient();
        main.checkInDocument();
    }
     
    public UcmClient() throws IdcClientException {
        // create the manager
        manager = new IdcClientManager();
    
        // build a client that will communicate using the intradoc protocol
        idcClient = (IntradocClient) manager.createClient(idcConnectionUrl);
    
        // get the config object and set properties
        idcClient.getConfig().setSocketTimeout(socketTimeout); // 30 seconds
        idcClient.getConfig().setConnectionSize(connectionSize); // 20
    
        // create a trusted user context
        userContext = new IdcContext(sysadmin);
    }
    

  4. Buat method checkInDocumen()
  5. public void checkInDocument() throws IdcClientException, IOException {
     // create request
     DataBinder binder = idcClient.createBinder();
     binder.putLocal("IdcService", "CHECKIN_UNIVERSAL");
    
     // get the binder
     binder.putLocal("dDocTitle", "Test Checkin Document");
     binder.putLocal("dDocName", "Test Checkin Document Using Java");
     binder.putLocal("dDocType", "Document");
     binder.putLocal("dSecurityGroup", "public");
    
     // add a file
     binder.addFile("primaryFile", new TransferFile(new File("/Test.docx")));
    
     // check in the file
     ServiceResponse response = idcClient.sendRequest(userContext, binder);
    
     DataBinder binderResult = response.getResponseAsBinder();
     Collection resultSetNames = binderResult.getResultSetNames();
      
     for (String name : resultSetNames) {
     System.out.println(name);
     }
    }
    

  6. Buat object main untuk melakukan execute method checkInDocument
  7. public static void main(String[] args) throws IdcClientException, IOException {
     // TODO Auto-generated method stub
     UcmClient main = new UcmClient();
     main.checkInDocument();
    }
    

Berikut adalah source code lengkapnya.

import java.io.File;
import java.io.IOException;
import java.util.Collection;


import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.model.DataResultSet.Field;
import oracle.stellent.ridc.model.TransferFile;
import oracle.stellent.ridc.model.impl.DataObjectImpl;
import oracle.stellent.ridc.model.impl.DataResultSetImpl;
import oracle.stellent.ridc.protocol.ServiceException;
import oracle.stellent.ridc.protocol.ServiceResponse;
import oracle.stellent.ridc.protocol.intradoc.IntradocClient;

public class UcmClient {

 public static final String idcConnectionUrl = "idc://localhost:4444";
 public static final String sysadmin = "weblogic";
 public static final int socketTimeout = 30000;
 public static final int connectionSize = 20;

 private IntradocClient idcClient;
 private IdcClientManager manager;
 private IdcContext userContext;

 public static void main(String[] args) throws IdcClientException, IOException {
  // TODO Auto-generated method stub
  UcmClient main = new UcmClient();
  main.checkInDocument();
 }
 
 
 public UcmClient() throws IdcClientException {
  // create the manager
  manager = new IdcClientManager();

  // build a client that will communicate using the intradoc protocol
  idcClient = (IntradocClient) manager.createClient(idcConnectionUrl);

  // get the config object and set properties
  idcClient.getConfig().setSocketTimeout(socketTimeout); // 30 seconds
  idcClient.getConfig().setConnectionSize(connectionSize); // 20

  // create a trusted user context
  userContext = new IdcContext(sysadmin);
 }
 
 public void checkInDocument() throws IdcClientException, IOException {
  // create request
  DataBinder binder = idcClient.createBinder();
  binder.putLocal("IdcService", "CHECKIN_UNIVERSAL");

  // get the binder
  binder.putLocal("dDocTitle", "Test Checkin Document");
  binder.putLocal("dDocName", "Test Checkin Document Using Java");
  binder.putLocal("dDocType", "Document");
  binder.putLocal("dSecurityGroup", "public");

  // add a file
  binder.addFile("primaryFile", new TransferFile(new File("/Test.docx")));

  // check in the file
  ServiceResponse response = idcClient.sendRequest(userContext, binder);

  DataBinder binderResult = response.getResponseAsBinder();
  Collection resultSetNames = binderResult.getResultSetNames();
  
  for (String name : resultSetNames) {
   System.out.println(name);
  }
 }
}

Ada banyak API yang dapat kita gunakan selain untuk kebutuhan Check-in dokumen, kita juga dapat melakukan create user, delete user hingga pembuatan account. Untuk contoh java create user-nya ada di part2 ya..


Referensi
https://docs.oracle.com/cd/E23943_01/doc.1111/e10807/c21_idc.htm#CSSDK325

Sunday, September 18, 2016

Cara Merubah Layout Pada Webcenter Portal

Pada kesempatan ini saya ingin berbagi cara untuk merubah tampilan layout pada suatu page tertentu di webcenter portal.

  1. Pertama tama masuk ke menu administer portal yang sudah kalian buat



  2. kemudian pada bagian Edit Portal, kalian pilih page mana yang ingin kalian edit layout nya.
    Jika sudah klik edit page pada bagian atas kanan
  3. Klik change layout
  4. Pilih layout yang akan kalian gunakan

  5. Save
Layout yang bisa dipakai itu sangat banyak, tidak terbatas dari apa yang sudah di sediakan saja, namun kita jg bisa membuat sendiri layout seperti apa yang ingin kita inginkan.

Selamat mencoba !

Sunday, December 15, 2013

Customize bahasa di webcenter spaces

Blog kali ini saya akan membahas bagaimana menambah/customize bahasa di webcenter spaces.

Sebelom memulai :
Overview :

Langkah 1 buka sample project dengan jdeveloper,buka project LanguageAdditions . Dapat dilihat gambar di bawah terdapat java resource bundle class yang bernama WebCenterResourceBundle_ca. Dengan kelas tersebut kalian bisa menambahkan bahasa baru "ca" tersebut merupakan id untuk sebuah bahasa (Catalan). Jika kalian ingin mengubah bahasa inggris tinggal mengganti "ca" menjadi "en".

Langkah 2 buka file supported-language dan tambahkan jika kalian menggunakan bahasa baru yg tidak di dukung webcenter spaces


Langkah 3 buka file config.properties. 

Langkah 4 klik clean-stage, lalu klik deploy-shared-lib

Langkah 5 untuk membuat bahasa barua tersedia di spaces application, tambah "Catalan" <language> tag untuk supported-languages.xml
  • buka Weblogic Scripting Tool (WLST) di WC_ORACLE_HOME/common/bin
  • gunakan command WLST exportMetadata untuk download supported-languages.xml dari MDS.   ExportMetadata(application='webcenter',server='WC_Spaces',toLocation='/tmp/myMDSfiles',docs='/oracle/webcenter/webcenterapp/metadata/supported-languages.xml') 
  • Lalu edit file dan tambahkan : <language name=" Catalan" id="ca" used="true" activeicon="nlse_a.gif" inactiveicon="nlse.gif" translated="true"/>
     
  • Dan langkah terakhir gunakan WLST command importMetadata.
     importMetadata(application='webcenter', server='WC_Spaces', fromLocation='/tmp/myMDSfiles',docs='/oracle/webcenter/webcenterapp/metadata/supported- languages.xml')


Langkah 6  - editing shared library list (weblogic.xml). Untuk lebih detail klik link ini.


Langkah Terkahir login ke Spaces Application ke menu administration -> ganti default language 


Klik disini untuk language pack spaces
Sekian blog singkat saya :D 







Monday, December 9, 2013

Webcenter Portal (Spaces) and Oracle BPM Integration - Part 2


Blog ini melanjutkan Webcenter Portal (Spaces) and Oracle BPM Integration - Part 1. Sekilas review, blog ini akan menjelaskan bagaimana caranya mengintegrasikan workspace yang ada di Oracle BPM ke dalam Webcenter Portal. Hal ini diperlukan apabila anda mengimplementasi Portal dan BPM bersamaan, tapi ingin BPM diakses melalui Portal. Sebelum membaca blog ini, silahkan terlebih dahulu membaca Part1-nya agar dapat lebih memahami langkah-langkah yang dilakukan dari awal :)

Prerequisite:


  • Webcenter Portal, Oracle BPM dan Webcenter Content sudah terinistall (tutorial ini menggunakan versi 11.1.1.7 untuk ketiga sistem)
  • Basic knowledge untuk navigasi ke folder-folder instalasi masing-masing komponen diatas :)
  • Membaca dan mengeksekusi Webcenter Portal (Spaces) and Oracle BPM Integration - Part 1

Langsung saja kita lanjutkan.

1. Masuk ke folder oracle_common/common/bin dan jalankan ./config.sh

2. Configuration Wizard terbuka. Pilih 'Extend my domain using an existing extension template'. Pilih template bpm yang ada di folder /templates/applications/oracle.bpm.spaces_template_11.1.1.jar. Ini akan meng-extend dan meng-include jar yang diperlukan oleh Webcenter Spaces anda untuk menjalankan workspace BPM. Lokasi template biasanya ada di: ~/Oracle_WC1/common/templates/applications/oracle.bpm.spaces_template_11.1.1.jar

3. Layar configuration summary akan terbuka, pilih Extend untuk meng-extend domain anda.
4. Progress screen tentunya :)
5. Copy folder berikut:
~/Oracle/Middleware/Oracle_SOA1/bpm/process_spaces/
ke ~/Oracle/Middleware/process_spaces. Edit file process-portal-install.properties. Berikut adalah contoh untuk environment yang saya gunakan. Anda dapat sesuaikan berdasarkan environment anda (Cluster, Database Name dsb). Pastikan property extendSoa = false.
################################################
# BPM Process Portal installation properties   #
################################################

#  Flag to decide whether to extend existing BPM domain or create a new one.
#  Set extendSoa to true, if the webcenter space and the SOA server are running in the same domain  
#  Set extendSoa to false, if the webcenter space and the SOA server are running in different domains
extendSoa=false

#  Flag to decide whether install will prompt for passwords or read them from this file
promptForPasswords=false

#
#  Setting up domain global trust
#  Provide information to set up trusted domains between the webcenter domain and the SOA domain
#
#  Flag to control whether to set domain realm password or not, set to true if extendSoa is false
wcSetDomainRealmPassword=true
#  This is the password to setup trusted domains. Same password should be set on BPM domain as well
wcDomainRealmPassword= password
wc.server.port=8888

#
#  Information of SOA server to which webcenter space is connected.
#

#  BPM Schema and MDS details
#  Provide the SOA MDS database and schema details here
bpmDBUser=DEV_SOAINFRA
bpmDBPassword= password
bpmDBType=ORACLE
bpmDBDriver=oracle.jdbc.OracleDriver
bpmDBUrl=jdbc:oracle:thin:@ORACLEDB:1521:ORCL


bpmMDSUser=DEV_MDS
bpmMDSPassword=password

#
#  BPM Runtime details
#  Provide the BPM server weblogic and admin credential here
#

# Specify the BPM server URL (t3://<bpmHost>:<bpmRuntimePort>) in the case of a single
# BPM server, ex- t3://myHost:8001
# In case of BPM Cluster provide the ',' separated list of BPM servers URL's (t3://<host1>:<port1>,<host2>:<port2>,...)
# for all the servers in the Cluster . Example: t3://myHost1:8001,myHost2:8002,myHost3:8003
bpmServerURL=t3://SOABPM1:8001

bpmAdminUser=weblogic
bpmAdminPassword=Passw0rd01


#
#  Information of the Webcenter server where process BPM process portal would be installed
#

#
#  Webcenter spaces installation details
#  Provide the webcenter space server information
#
#  Provide the oracle home location of the webcenter install (e.g. /Oracle/Middleware/Oracle_WC)
#  in wcOracleHome
wcOracleHome=/u01/app/oracle/product/fmw/wc
#  Provide the Webcenter domain name in wcDomainName
#  --if extendSoa flag has been set to true, Webcenter domain name should be the same as SOA domain name
#  --if extendSoa flag has been to false, Webcenter domain name will be different from SOA domain name
wcDomainName=domain_name



#Mention Whether the webcenter install is configured for cluster or not;
#pass 'true' if in cluster mode, 'false' otherwise
isWebcenterClusterConfig=false

#Required if 'isWebcenterClusterConfig' is set to true
# Specify the name of the webcenter spaces Cluster
wcSpacesClusterName=

#  Webcenter's weblogic installation details
wcHost=SOABPM1
wcAdminPort=7701
wcAdminUser=weblogic
wcAdminPwd= password

#In the case of a single server environment,
#specify the name of the Webcenter Spaces Managed server. In a clustered environment,
#specify the name of any one of the Spaces managed servers that is part of the Cluster.
wcManagedServerName=WC_Spaces


#Flag to control whether to configure services
wcConfigServices=true

#content server details
wcContentServerName=SOABPM1
wcContentServerPort=4444
wcContentSpacesRoot=/WebCenter0809
wcContentAdminUser=weblogic

#discussion server details
wcDiscussionServerUrl=http://SOABPM1:8890/owc_discussions
wcDiscussionAdminUser=weblogic


6. Jalankan ant script dengan memasukkan command berikut:


7. Build successful akan muncul apabila konfigurasi yang anda buat di tahap nomor 5 sudah benar.
8. PENTING!! Edit lagi file konfig di langkah nomor 5. Pastikan value extendSoa=true. Jalankan kembali script dengan mengeksekusi perintah di step nomor 6 dan hasil berikut muncul:



9. Restart Seluruh Managed Server dan Admin Server anda.

10. Masuk ke Weblogic Server /em. Navigasi ke server Webcenter Portal Anda. Pilih Application Configuration -> Service Configuration dan layar berikut akan muncul. Cek di bagian Content Repository, pastikan bahwa koneksi portal-content-server berhasil dibuat dan menjadi active connection.
11. Klik koneksi tersebut, ganti Administrator User Name menjadi user name admin anda (dalam kasus saya weblogic).
12. Cek juga di Discussion and Announcement, koneksi baru, portal-discussions berhasil juga dibuat.
13. Kedua tahap diatas menandakan bahwa konfigurasi anda berhasil dan BPM Workspace sudah dapat diakses melalui Spaces!

14. Log in ke dalam spaces dan anda akan menemukan Spaces baru bernama Process Spaces. Ini adalah BPM workspace yang telah terintegrasi ke dalam portal. Disini anda dapat log in, membuat task baru, membuka task yang di-assign kepada anda dan melakukan proses approval layaknya fungsionalitas yang ada di BPM.

Apabila anda membuat project BPM baru dan mendeploynya ke soa_infra, maka otomatis project/process ini akan muncul juga di Process Workspace yang ada di Webcenter Spaces. Akses user untuk menggunakan aplikasi di BPM sekarang sudah dapat diarahkan melalui portal!

Selamat! Anda berhasil mengintegrasikan BPM Workspace dan Spaces Anda.
Semoga membantu. See u in the next blog!