Pages

Friday, May 16, 2014

Use Adf Skin to chane the Defaults

If you want to make changes to the appearance of Oracle Fusion Applications pages, like Change the Font size and Color any other Skin related changes. Use ADF Skin Editor to create a custom skin based on the Oracle Fusion Applications Skin Extension (fusionFx-simple) and apply that skin to your Oracle Fusion applications.

Created a Sample Application with UIShell (To Create UI Shell please fallow this post).


To create new ADFskins:

An ADF skin is a type of CSS file where you define CSS style properties based on the Cascading Style Sheet (CSS) specification for the component for which you want to customize the appearance.

1. In the Application Navigator, Right-click the ViewController project and select New from the context menu.
2. In the New Gallery, expand the Web Tier node, select JSF/Facelets and in the right hand pane, select ADF Skin as the item.
3. In the Create ADF Skin File dialog, change the file name to MyNewSkin.css. Append \MyNewSkin to the existing skins directory path. Check the Use as the default skin family for this project checkbox.
4. Please Select the Default Skin and click finish.
It will create a .CSS file in the location, it will update the "trinidad-config" file with Default Skin and it will update the "trinidad-skins" file with selected skin details.



Open the newly create css file. It will open in the ADF Skin Extension editor.
Select the "Selectors" View.
In the Selectors view, expand "Global Selectors Aliases" -> Font -> select AFDefaultFont:alias.

In the property inspector change the Font - size.
This will change all the font sizes in the application except Field level data(Content).

To change the Field level content, Expand "Faces Component Selectors" -> Expand the component "Input Text" -> Expand pseudo-Elements -> Select Content. Then open the property inspector and change the font-size.

Then all the fonts in the page is modified.



Like this you can modify any of the Styles related to ADF components.

Links: ADF CSS HELP

Thursday, May 15, 2014

Fusion Applications Unique ID Generation with 3 different ways

Fusion applications Primary key OR Unique id generation can be done in 3 different ways.

1. Using Standard Fusion Concept.

          ADF BC's unique id generation feature uses a database table to specify the range of ids that may be used, as well as the latest id in the sequence.  Create a database table named S_ROW_ID and add one row of data to the table, using the following format:

Column Name Data Type Comments
START_ID NUMERIC(38,0) Starting id in the range. To avoid duplicate key errors, you must make sure this value is higher than any existing primary key values in your database.
NEXT_ID NUMERIC(38,0) Next available id within current range (optional).
MAX_ID NUMERIC(38,0) Maximum id in the range 
AUX_START_ID NUMERIC(38,0) Starting id in auxiliary block range (use 0 if no auxiliary block is available).
AUX_MAX_ID NUMERIC(38,0) Maximum id in the auxiliary block range (use 0 if no auxiliary block is available).

CREATE TABLE S_ROW_ID 
(
  START_ID NUMBER 
, NEXT_ID NUMBER 
, MAX_ID NUMBER 
, AUX_START_ID NUMBER 
, AUX_MAX_ID NUMBER 
);

insert into  "S_ROW_ID" ( "START_ID" , "NEXT_ID" , "MAX_ID" , "AUX_START_ID" , "AUX_MAX_ID" ) 
                         values (1,1,9999999999999999999,0,0);

In the Application Module -> Configurations section -> Edit local configuration -> Properties tab

Provide the Database connection name where the S_ROW_ID table is created jbo.rowid_am_conn_name.


In your Entity object, Under attribute properties select the Default value as Expression and provide this "oracle.jbo.server.uniqueid.UniqueIdHelper.getNextId()".


Sample Screen Shots:
The EmpId is Generated from the Id helper.
2. Generate Primary Key using Default Value Expression

          To do this we need a Database sequence. When user creates new row in the Entity object we will get the nextValue from the DB sequence.

Select the primary key attribute in the Entity object, In the properties section change the "Updatable property to While New". Change the Default Value to Expression and provide value as "adf.object.nextVal("UNIQUEIDTESTTABLE_1_SEQ");".

In the Entityimpl create a method nextValue as

    protected oracle.jbo.domain.Number nextVal(String sequenceName) {
        SequenceImpl s = new SequenceImpl(sequenceName, getDBTransaction());
        return s.getSequenceNumber();
    }


Sample Screen shots:
When you click on the new record the Empid is pre-populated.


3. Generate Primary Key using Database Triggers

          To do with database Tiggers and DBsequence data type. when an entity object's primary key attribute is of DBSequence type, during the transaction in which it is created, its numerical value is a unique, temporary negative number. If you create a number of associated entities in the same transaction, the relationships between them are based on this temporary negative key value. When the entity objects with DBSequence-value primary keys are posted, their primary key is refreshed to reflect the correct database-assigned sequence number.

Crated a database Trigger.

CREATE TABLE UNIQUEIDTESTTABLE_2
(
  EMPID NUMBER NOT NULL
, EMPNAME VARCHAR2(30 BYTE)
, EMPLOCATION VARCHAR2(30 BYTE)
, CONSTRAINT UNIQUEITTESTTABLE_2_PK PRIMARY KEY
  (
    EMPID
  )
  ENABLE
);

CREATE OR REPLACE TRIGGER UNIQUEIDTESTTABLE_2_ins_trig BEFORE
  INSERT ON UNIQUEIDTESTTABLE_2 REFERENCING NEW AS NEW FOR EACH ROW
  BEGIN
  SELECT UNIQUEIDTESTTABLE_1_SEQ.nextval INTO :NEW.EMPID FROM dual;
  END;
  /
  
In the Entity object  change the primary key attribute data type to DBSequence. This will automatically change other properties like
  • Updatable to While New
  • Checked Refresh on Insert
  • Default value to Literal and Value is some thing like @0

Sample Screen Shots:

When you click on new record the adf will automatically create a negative unique number. and when click on commit button then the actual primary key will be added to the record.

Sample Code.