Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Thursday, 12 June 2014

SVN - The Good The Bad and The Ugly

SVN - History

So Recently I was told by someone that SVN "Looses" History, because the information he committed is not there.

So I wanted to do some Experiments.

What I needed

  • Local SVN
  • Project
  • Files

Initially, I created a local SVN Using Tortoise SVN.
Then I created a small Hello World Project Using ADF, with one page, and as we all know, doing something so simple creates many folders.
First Commit

Browse


First Log

When I add a Task Flow, with a page, the commit looks like this;
Task Flow Commit

If you press ok, at this stage without any changes, you task flow WILL NOT, i repeat WILL Not be committed to SVN. The folder icon will also be changed to look like it has all been committed.

After this, there are two scenarios that may happen after this, if you carry on working from the same project, everything will work as expected.

If you download the project from SVN, you will get errors, most probably ones saying the pages do not exist.

SVN Commit

When doing this make sure, if any new files were added, add them to be committed. 
non-versioned Commit
Commit Log
Make sure the non-versioned Status has been Checked. This can be done by clicking all, just above the file names.

Log

Please Note: The Actions in the Log, in the above picture, there are only adds, and Modifies. In the Below One there is a delete as well as Modify.


One thing to note: is now that I have done all this, no matter what I do on the SVN, those logs will never be changed.

The only things that one can change are the Author and "Message"

This is a very limited example of a SVN Server with Revisions, but I just wanted to show that there are certain things that you cannot do with a SVN, and there are certain things that one needs to do, otherwise your SVN commits will break the application.

#bearMan, f

Friday, 29 November 2013

ADF - Weblogic Timer Error

ADF - Weblogic Timer Error

My Error Stack trace looked something like this:

TimerManager requested: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
TimerManager  obtained: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
WorkManager  requested: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@b7b91c
WorkManager   obtained: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@1da10ec'
weblogic.application.ModuleException: Existing timer manager has different work manager.
TimerManager requested: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
TimerManager  obtained: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
WorkManager  requested: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@b7b91c
WorkManager   obtained: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@1da10ec


In order to solve this I restarted my Integrated Weblogic Server.

it was caused by me trying to run an application before the previous run initialized.

#bearMan

Friday, 22 November 2013

ADF - JSTL 1.1 Tags, JSTL 1.2 Tags.

Must choose only one of libraries: JSTL 1.1 Tags, JSTL 1.2 Tags.

To fix this error, right click on your Project View controller, Select Project Properties

Project Properties

Click on Libraries and Classpaths, and in this case I had three duplicates to I selected then all, as I needed none of them, as the library was already included at the top.


I clicked Remove, OK and then I was done.

make sure you don't remove all of these Libraries.

#bearMan, saving you money, putting you first.

Wednesday, 20 November 2013

ADF - XML-24521

ADF Compiler "Element not completed: 'task-flow-reentry'"


Warning(5,54): <Line 5, Column 54>: XML-24521: (Error) Element not completed: 'task-flow-reentry'


My Task Flow xml File.

<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <task-flow-definition id="inforClientSearch">
    <default-activity id="__1">Search</default-activity>
    <task-flow-reentry id="__18"></task-flow-reentry>
    <view id="Search">
      <page>/Search.jsff</page>
    </view>
    <control-flow-rule id="__2">
      <from-activity-id id="__3">Search</from-activity-id>
      <control-flow-case id="__5">
        <from-outcome id="__6">create</from-outcome>
        <to-activity-id id="__4">AddNewClient</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <control-flow-rule id="__10">
      <from-activity-id id="__11">AddNewClient</from-activity-id>
      <control-flow-case id="__12">
        <from-outcome id="__14">cancel</from-outcome>
        <to-activity-id id="__13">Search</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <use-page-fragments/>
  </task-flow-definition>
</adfc-config>

to solve it I took out the

<task-flow-reentry id="__18"></task-flow-reentry>

To make My Task Flow xml file look like:
<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <task-flow-definition id="inforClientSearch">
    <default-activity id="__1">Search</default-activity>
    <view id="Search">
      <page>/Search.jsff</page>
    </view>
    <control-flow-rule id="__2">
      <from-activity-id id="__3">Search</from-activity-id>
      <control-flow-case id="__5">
        <from-outcome id="__6">create</from-outcome>
        <to-activity-id id="__4">AddNewClient</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <control-flow-rule id="__10">
      <from-activity-id id="__11">AddNewClient</from-activity-id>
      <control-flow-case id="__12">
        <from-outcome id="__14">cancel</from-outcome>
        <to-activity-id id="__13">Search</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <use-page-fragments/>
  </task-flow-definition>
</adfc-config>


It was caused by an error with when I was working on the "Task Flow Reentry" Behaviour for the task Flow. When I set it back to default, for some reason it did not set it back correctly

#bearMan

Monday, 28 October 2013

ADF - Region Error Multiple Root Components

The region component with id: x has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.

This error does not have anything to do with your Page holding your Region, it has to do with your Region (r1 - tfdAssignGraph).

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core">
  <af:decorativeBox id="db1">
    <f:facet name="center"/>
    <f:facet name="top"/>
  </af:decorativeBox>
  <af:decorativeBox id="db2">
    <f:facet name="center"/>
    <f:facet name="top"/>
  </af:decorativeBox>
</jsp:root>


You can solve the issue by having some other component as the "Root" component, like this:
Resolved is replacing what you have with one "Root" Component.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core">
  <af:panelGroupLayout id="pgl1">
    <af:decorativeBox id="db1">
      <f:facet name="center"/>
      <f:facet name="top"/>
    </af:decorativeBox>
    <af:decorativeBox id="db2">
      <f:facet name="center"/>
      <f:facet name="top"/>
    </af:decorativeBox>
  </af:panelGroupLayout>
</jsp:root>

I hope this helps.

#bearMan

Friday, 25 October 2013

ADF CheatSheet: Create Bindings Quickly

ADF CheatSheet: Create Bindings Quickly


Hello and welcome back to my evolutionary blog ;)

Have you ever needed to create many Page Bindings, quickly, but not needed a UI for them?

A quick way to create them is to find the attribute you needed in the Bindings area, and drag and drop that binding as though you were creating the UI for it. Once the UI part of it is done, you can cut that component off, there will be a dialog to ask if you want to remove the Bindings as well, and you must say no.

ctrl+X

Before
After

#bearMan out.

Wednesday, 23 October 2013

ADF - Synchronizing form with recursive tree


ADF - Synchronizing form with recursive tree

We have a recursive tree, and we need a table to be edited. The form needs to update on tree selection.

Firstly, I am am going to be using the HR schema and the Employees Table.

My Data Controls
Data Controls, with employee Recursion

Firstly I created the Tree on the page (With the Employees1 Data Control) this resulted in the following bindings:

Page Bindings - Tree


Then I Created the Form on the Page (with EmployeesForm Data Control), this resulted in the following Bindings.
Page Bindings - Tree and Form
Once that was completed, I selected the Employees1 Binding, and changed the EL Expression, by clicking the "EL Picker" button, selecting the "EmployeesFormIterator".

EL EXpression Picker
Then on the Page, I changed the Forms Partial Trigger to being the Tree

Then you are ready to go.

Run the Application, and here are two screen shots of the results.

Screen Shot 1

Screen Shot 2

Hope this helps you.

#bearMan out.

ADF - Tree Table Display Field

ADF - Tree Table Display Specific Field

If you need to display a certain field in within a tree Component, but are not wanting to display that attribute, this will help you to display.
Unclean Display
Clean Display

if you only want to display one Attribute, you can follow these steps.

Firstly you need to click on the tree, and take note of what attributes you want to display.
Country Display Attribute
For this Tree level we want to display the Country Name -> "CountryName"
Location Display Attributes
For the second level of the tree, we want to display the Province -> "StateProvince"

Once you have gotten that, you must go to the page, and select the tree you want to display.
Change the Output text Value from #{node} to #{node.CountryName}
Output Text Value Selection and Change
Add a Output Text to the Node Stamp, this can either be done using the component Palette or By Coping and Pasting the Current Output Text.

Once that has been done, select and change that value to "#{node.StateProvince}"


The reason this works is because when there is no country there will be nothing in that Output Text.

If you get an error while doing this, you can change the rendered Value to 
#{node.StateProvince eq null?"false":"true"}

Enjoy ;)

#bearMan

Wednesday, 16 October 2013

ADF Security: Display User Roles

ADF Security: Display User Roles

so today I want to show you two things you can do, and this is how to display user roles in the Console.

The first method is,
ADFContext.getCurrent().getSecurityContext().getUserRoles();

This returns an array of Strings, this is an array of all the roles the user has against his / her name.

This code
for (String s : ADFContext.getCurrent().getSecurityContext().getUserRoles()) {
    System.out.println("\t\t" + s);
}

will display all the roles the logged in user has.

the import you will need for this code to work is:
import oracle.adf.share.ADFContext;

#bearMan out.

Monday, 7 October 2013

ADF CheatSheet: VO Attribute value

ADF CheatSheet: VO Attribute value

One thing I also do alot for auditing is setting Attributes to who created it or when it was created for those.

To see who edited something, or to set a value to an Attribute that is stored in a Session Variable you can use the code below in order to set the default value to that attribute.

adf.context.current.sessionScope.get('empId')
For Date
adf.currentDate
For Date and Time
adf.currentDateTime
Just one thing, make sure you set the sessionScope variable to the same Object type as the Attribute.
#bearMan

Friday, 4 October 2013

ADF CheatSheet: EO Sequence

ADF CheatSheet: EO Sequence

One thing I use alot is sequences, one thing you can do to set a default value to the sequence, is change a Attribute to Type: DBSequence and set the default value to

(new oracle.jbo.server.SequenceImpl("USERS_SEQ", object.getDBTransaction())).getSequenceNumber()

#bearMan

Thursday, 3 October 2013

ADF - XML-20108

ADF - XML-20108

Today my colleague had an error "XML-20108"

Error(1,1): <Line 1, Column 1>: XML-20108: (Fatal Error) Start of root element expected.

If the File that is causing the error is a ".rdf".
To fix this error all you need to do is delete the

If the file is another file, ie "xml" please make sure the first line in the file is
<?xml version="1.0" encoding="UTF-8"?>

#bearMan

Monday, 30 September 2013

ADF Basics: Refresh UIComponent within Manage Bean

ADF Basics: Refresh UIComponent within Manage Bean

This is a quick code tip:

     /**
*import javax.faces.component.UIComponent;
*
* PPR UIComponent
*
* @param UIComponent - The UIComponent wanting to be refreshed
*
*/
    public void refreshComponent(UIComponent component){
        AdfFacesContext.getCurrentInstance().addPartialTarget(component);  
    }

ADF Basics: Find UIComponent within Manage Bean

ADF Basics: Find UIComponent within Manage Bean

This is a quick code tip:

     /**
* FindUIComponent
*
* @param UIComponent - The UIComponent ID you are wanting to find
*
*/
private UIComponent findUIComponent(String name) {  
 FacesContext facesCtx = FacesContext.getCurrentInstance();  
 return facesCtx.getViewRoot().findComponent(name) ;  
}

#bearMan

Friday, 20 September 2013

ADF - Page Close Uncommitted Data Warning

ADF - Page Close Uncommitted Data Warning

Are you on a project where a user needs to be warned before closing a page when they have uncommitted Changes?

Yes?

Here is how to get a confirmation Box when the user wants to leave the page.

Go to the Page Structure, and then go to the af:document .

 In the property inspector Find "UncommittedDataWarning"

and turn that on.

Enjoy.

#bearMan

Thursday, 19 September 2013

ADF - Java Table Selection


ADF - Java Table Selection


This post is adding on to a previous post. Where I show you how to Overwrite the Table row selection

I will be using ADFUtils, and JSFUtils both of which are provided by Oracle.
(I have provided the Version I am working from, on a previous post)

The More advanced Row Selection Application can be found here.

Once you have created the method to select the Row, you can add:

    // get the current selected row
    Row selectedRow =
                (Row)JSFUtils.resolveExpression("#{bindings.EmployeesView1Iterator.currentRow}"); 
            //Set a pageFlowScope Variable
    JSFUtils.setExpressionValue("#{pageFlowScope.User}",
                                        selectedRow.getAttribute("FirstName") +
                                        " " +
                                        selectedRow.getAttribute("LastName"));



This will add the FirstName and Last Name go into the pageFlowScope.

have Fun!

#bearMan.

Tuesday, 17 September 2013

ADF Basics: Printing Behavior

ADF Basics: Printing Behavior

Hi

I will be showing you how to use the ADF showPrintablePageBehavior Component, how to get what you want to display on the "Print Ready Page"

ADF Print Demo Application can be downloaded here

I Created two Pages, both of which have have the same Components (Nearly), both pages have a button either to "Print" the Table Alone, or the Whole Page.

On the page where it prints only the Table, I surrounded the table with a panelCollection, and in the toolbar Region, I put the button with the showPrintablePageBehavior.
<f:facet name="toolbar">
 <af:toolbar id="t2">
   <af:commandToolbarButton text="Print Table"
                            id="ctb1">
     <af:showPrintablePageBehavior/>
   </af:commandToolbarButton>
 </af:toolbar>
</f:facet>

ADF Before Printed
Before Printed

ADF Table Printed
Printed


With the Page Print, I surrounded the whole page with a panelHeader and within that toolbar Region I added the same Button.
<f:facet name="toolbar">
 <af:toolbar id="t2">
   <af:commandToolbarButton text="Print Table"
                            id="ctb1">
     <af:showPrintablePageBehavior/>
   </af:commandToolbarButton>
 </af:toolbar>
</f:facet>

Before Printed ADF panelHeader
Before Printed


Printed ADF panelHeader
Printed

Extra

If you don't want a component to show when in Printing mode
use this EL expression in the Applicable Property
"#{adfFacesContext.outputMode eq 'printable' ? false : true}

Panel Box, not to display header
showHeader="#{adfFacesContext.outputMode eq 'printable' ? 'never' : 'ifNeeded'}"


Regards
#bearMan.

ADF - Customizing Table Row Selection


ADF - Customizing Table Row Selection

If you want to do something cool when a user clicks on a row within a Table, or if you just want to customize what happens when the row is clicked.

I use the JSFUtils class, and I am assuming you have this class in your project.
The ADF Utils can be found in a previous Post here

The Custom Table Row Selection Application is here.

Firstly after you have created the af:Table in the Property Inspector find the Selection Listener. I created my table off the HR Schema.


In the Selection Listener there was
#{bindings.EmployeesView1.collectionModel.makeCurrent}
As the default Value.

and either create a managed Bean or use one of your existing ones, and the same with a method.



I called my method "employeeTableSelectionListener" it accepts one Parameter "SelectionEvent" this is created by Default.

public void employeeTableSelectionListener(SelectionEvent selectionEvent) {
    //#{bindings.EmployeesView1.collectionModel.makeCurrent}
    System.out.println("We are in the employeeTableSelectionListener");
    JSFUtils.resolveMethodExpression("#{bindings.EmployeesView1.collectionModel.makeCurrent}",
                                     Object.class,
                                     new Class[] { SelectionEvent.class },
                                     new Object[] { selectionEvent });
}

Just remember please, after you have finished debugging the application, you should take the println out.

#bearMan.

Monday, 16 September 2013

ADF - Tree Table Column Drop Down

ADF - Tree Table Column Drop Down

To use Drop Down Lists in ADF Tree Tables. There are a few things to keep in mind.

Assumptions: I am using the HR schema, and I'm going to be working with the Employees table. You have already created the Attributes LOV (List Of Values)

Firstly when using the drop down list, the #{node.ManagerId} is not correct.

Remember to make sure all your attributes that you want to work with are in the Bindings of the table.

When using the drop down list, there are two components you need namely:
af:selectOneChoice
f:selectItems
af:selectOneChoice: is the Actual Selected Item
f:selectItems: is the List Of Values

Also keep in mind, all your Sub Levels within the Table, might not have that same Columns as the parent, and thus it will Display an error when this happens.

To make a editabledrop down List, you need to have a submit Button on the page, and make the af:selectOneChoice, autoSubmit="true".

Lets get to the Code.
<af:selectOneChoice required="#{node.bindings.ManagerId.hints.mandatory}"
 id="selectOneChoice1"
 rendered="#{node.ManagerId == null ? false : true}"
 value="#{node.bindings.ManagerId.inputValue}"
 autoSubmit="true">
  <f:selectItems value="#{node.bindings.ManagerId.items}"
  id="selectItems1"/>
</af:selectOneChoice>
A Quick Explination rendered="#{node.ManagerId == null ? false : true}"  Basically checks to see if the row has something, otherwise it does not display the Drop Down Box.

Note: This does not work if your Item initially is null, but you want to display it, I will be updating this on how to do it.
Update: You could try something like
#{node.bindings.ManagerId == null or node.bindings.ManagerId.estimatedRowCount > 0 ? false : true}
in the rendered Property

Good Luck

#bearMan.

Thursday, 12 September 2013

ADF Basics - Utils

ADF Basics - Utils


One thing everyone should know about in ADF is the Utils Packages Oracle Offer.

ADFUtils and JSPUtils.

Both these Util Classes hold a bunch of functions that everyone should know about and use.
From Getting the App Module, to components these classes hold a vast range of knowledge one should use.

The main thing is getting the awareness out there about what these Utils can do.

They can be downloaded within an application from Oracles website
http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html

Or from