Equal Classes in 2 Express BM
Hello,
i have an Express application with 2 Business Models having some classes
in common (no lucky !).
Of course, while compiling, i got an error message :
"USER ERROR: The name acteurclass is ambiguous in the project
TestAMWindows.
Both class GestionStockBMServices.ActeurClass and class
TestBMServices.ACTEURClass exist in supplier applications. You must
fully
qualify the reference."
Is there a tips to do it, or should manually (search & replace) change
the references of the windows ?
Cordialement.
Patrice Bourdon
Alliance Sante France
Tel : (33) 02.54.60.26.27
Fax : (33) 02.54.60.25.00
eMail : [email protected]
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
Hello,
i have an Express application with 2 Business Models having some classes
in common (no lucky !).
Of course, while compiling, i got an error message :
"USER ERROR: The name acteurclass is ambiguous in the project
TestAMWindows.
Both class GestionStockBMServices.ActeurClass and class
TestBMServices.ACTEURClass exist in supplier applications. You must
fully
qualify the reference."
Is there a tips to do it, or should manually (search & replace) change
the references of the windows ?
Cordialement.
Patrice Bourdon
Alliance Sante France
Tel : (33) 02.54.60.26.27
Fax : (33) 02.54.60.25.00
eMail : [email protected]
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
Similar Messages
-
Turning class into loose expression
I have a class as you see below;
public class LoginScreen extends CustomNode{
var x;
override function create():Node{
loginGroup=Group{
content: [....
I want to turn it into a loose expression so like
var x;
function create(){
login group=Group{
content:[....
but when I change the code and run the application I can't see anything. What should I do and what are the things that I should consider before I change the class into a loose expressionI don't know. It's a reeeeaaallllyyyyyy good question and I'm SURE that is was never ever asked before on this forum. Let see I'll try to do a forum search to see if someone else ever thought about this.
Regards -
Bracketed expression calculator logical error
Hi,
i've being working on a calculator which can handle expressions such as
5 + 6 * 2 which results in 17 (so far only works well for this expression)
(5 + 4) * (4 - 2) which results in 18
(4 + (2 * (2 - 1))) * 1.2 results in 4.8
given an input of an expression at command line for instance
(6+3)*(5-1)
my program would evaluate this expression using the following code( various print statement to that i was using to help me see what exactly was going on):
fields within this class are:
private Stack<String> expression = new Stack<String>();
private Double x;
private Stack<String> temphold = new Stack<String>();
private String b = "";
private String f;
userEntry.trim();
String[] temp = userEntry.split("[()]");
for (int i = 0 ; i < temp.length ; i++) {
String a = temp;
System.out.println(a);
dump(temp);
if(userEntry.startsWith("end")) {
finished = true;
System.out.println("Thank You for using Calculator");
* dump. Places the input into a char array and push each
* char to stack.
* @param temp array of strings to be tokenized and
* pushed ontop of stack.
private void dump(String[] temp)
for (int i = 0 ; i < temp.length ; i++) {
String a = temp[i];
final char[] chars = a.toCharArray();
for(char c : chars) {
Character C = new Character(c);
String token;
token = C.toString(); ......
while (expression.size() >= 2) {
String X = new String();
String Y = new String();
X = expression.pop();
//System.out.println("Test2 "+X);
if (X.equals("+")) {
Y = expression.pop();
double y = Double.parseDouble(Y);
System.out.println(y+"to add");
System.out.println(x+"to add");
String result = Double.toString(Operation.PLUS.eval(x,y));
System.out.println("Addition result"+result);
output(result,expression);
System.out.println(expression.peek());
else if (X.equals("-")) {
Y = expression.pop();
double y = Double.parseDouble(Y);
System.out.println(y+"to minus");
System.out.println(x+"to minus");
String result = Double.toString(Operation.MINUS.eval(y,x));
System.out.println("subtraction result"+result);
output(result,expression);
System.out.println(expression.peek());
else if (X.equals("/")) {
Y = expression.pop();
double y = Double.parseDouble(Y);
String result = Double.toString(Operation.DIVIDE.eval(y,x));
output(result,expression);
else if (X.equals("*")) {
Y = expression.pop();
double y = Double.parseDouble(Y);
System.out.println(y+ "to multiply");
System.out.println(x+"to mutliply");
String result = Double.toString(Operation.TIMES.eval(x,y));
output(result,expression);
else {
try { x = Double.parseDouble(X); }
catch (NumberFormatException e) {
System.out.println("Unrecongizned Expresssion"); }
System.out.println("Answer: "+expression.peek());
System.out.println("expression size after all calculations: "+expression.size());
System.out.println();
expression.clear();
Expressions restart = new Expressions();
private void output(String ans,Stack<String> stack)
stack.push(ans);
} the out put of the program after carry out the coding body is:
(6+3)*(5-3)
6+3
5-3
Testing token 6
Testing token +
Testing token 3
Testing token *
Testing token 5
Testing token -
Testing token 3
5.0to minus
3.0to minus
subtraction result2.0
2.0
3.0to multiply
2.0to mutliply
6.0to add
6.0to add
Addition result12.0
12.0
Answer: 12.0
expression size after all calculations: 1
As you can see from from the output, the multiplication gets excuted at a wrong time and using the wrong operands. Any ideas/input into how i can over come this problem and improve the structure of this class would be so helpful as am i pretty much stuck without scraping this implement and taking on a different approach.
If anythings needs explain or adding to feel free to say though i am not entirely convinced with code :|.
THANKS ALOT!!newark wrote:
It'd be nice to see what class(es) the code you posted belongs to, as well as how they get called. Much easier to trace calls when you can see them being made.
Oh, and what code is printing this?
6+3
5-3
Testing token 6
Testing token +
Testing token 3
Testing token *
Testing token 5
Testing token -
Testing token 3i have the following classes
Operators$Operation$4.class
Operators.java
Operators$Operation$1.class
Operators$Operation$3.class
Operators$1.class
Operators.class
Calculator.java
Expressions.class
Operators$Operation$2.class
Calculator.class
Expressions.java
Operators$Operation.class
The Calculator simply display a greeting message and creates an instantiated of the Expression class, this Expression class implements all the before code i posted and is a child of the Operators class .
abstract class Operators
/** Creates a new instance of Operators */
public Operators()
* enum types to spefcifc te equation to be calcuated and returned.
* overridden at call with the speific equation to be carried out.
public enum Operation
PLUS { @Override
double eval(double x, double y) { return x + y; } },
MINUS { @Override
double eval(double x, double y) { return x - y; } },
TIMES { @Override
double eval(double x, double y) { return x * y; } },
DIVIDE { @Override
double eval(double x, double y) { return x / y; } };
/** Do arithmetic op represented by this constant */
abstract double eval(double x, double y);
}taken from the code from my first post the below code prints:
6+3
5-3
userEntry.trim();
String[] temp = userEntry.split("[()]");
for (int i = 0 ; i < temp.length ; i++) {
String a = temp;
System.out.println(a);
}taken from the code from my first post the below code prints:
Testing token 6
Testing token +
Testing token 3
Testing token *
Testing token 5
Testing token -
Testing token 3private void dump(String[] temp)
for (int i = 0 ; i < temp.length ; i++) {
String a = temp[i];
final char[] chars = a.toCharArray();
for(char c : chars) {
Character C = new Character(c);
String token;
token = C.toString();
System.out.println("Testing token "+token); -
Is this expression correct?
TOPLink.Public.Sessions.Session session = com.owensum.shared.persistence.Sessions.service().getSession();
TOPLink.Public.Expressions.ExpressionBuilder eb = new ExpressionBuilder();
TOPLink.Public.Expressions.Expression ex = eb.get("insured").equal(insured);
if(useMax)
TOPLink.Public.Expressions.ExpressionBuilder pb = new ExpressionBuilder(com.owensum.rushmore.policy.Policy.class);
TOPLink.Public.QueryFramework.ReportQuery rq = new ReportQuery(pb);
rq.setReferenceClass(com.owensum.rushmore.policy.Policy.class);
rq.addMaximum("POLICY_NUMBER", pb.get("policyNumber"));
TOPLink.Public.Expressions.Expression crit = pb.get("insured").equal(insured);
crit = crit.and(pb.get("stinger").get("drawing").equal("I"));
rq.setSelectionCriteria(crit);
ex = ex.and(eb.get("policyNumber").equal(rq));
com.owensum.rushmore.policy.Policy plcy = (com.owensum.rushmore.policy.Policy)session.readObject(com.owensum.rushmore.policy.Policy.class, ex);
com.owensum.shared.persistence.Sessions.service().releaseSession(session);
return plcy;
I get a null value... I pass in true for boolean useMax... is the expression ex = ex.and(eb.get("policyNumber").equal(rq)); the correct expression to retrieve a value based on the criteria stated? Does any one see anything syntactically wrong with the above method body? Thanks.I do not see anything syntactically incorrect with the expression you are creating. Have you tried issuing the ReportQuery separately? Can you narrow the query down to determine which expression component is failing on the comparison? What SQL is being generated?
--Gordon -
NEED HELP:To Parse Conditional Operator Within An Expression.
Hi there:
I'm having some difficulties to parse some conditoional operator. My requirements is:
Constants value: int a=1,b=2,c=3
Input/Given value: 2
conditional operator expression: d=a|b|c
Expected result: d=true
Summary: I like to receive a boolean from anys expressions defined, which check against Input/Given value.Note: The expression are various from time to time, based on user's setup, the method is smart enough to return boolean based on any expression.
Let me know if you have any concerns.
Thanks a million,
selenahere is a simple example.
BNF changes
EXPR ::= OPERATOR
EXPR ::= OPERATION OPERANT EXPR
This is as far as I can go, please use it as a template only
because you need to take into account the precedence using ()
the logic of the eval was simply right to left so I think it is not what you want
Cheers
public interface Expression
String OR = "|";
String AND = "&";
public boolean eval(int value) throws Exception;
public class ExpressionImpl implements Expression
public String oper1;
public String operant;
public Expression tail;
/* (non-Javadoc)
* @see parser.Expression#eval()
public boolean eval(int value) throws Exception
int val1 = getValue(oper1);
if (null == tail)
System.out.println(val1 + ":" + value);
return (val1 == value);
else
if (OR.equals(operant))
return (val1 == value || tail.eval(value));
else if (AND.equals(operant))
return (val1 == value && tail.eval(value));
else
throw new Exception("unsupported operant " + operant);
private int getValue(String operator) throws Exception
Integer temp = ((Integer)Parser.symbol_table.get(operator));
if (null == temp)
throw new Exception("symbol not found " + operator);
return temp.intValue();
public String toString()
if (null == operant) return oper1;
return oper1 + operant + tail.toString();
public class Parser
public static HashMap symbol_table = new HashMap();
* recursive parsing
public Expression parse(String s)
ExpressionImpl e = new ExpressionImpl();
e.oper1 = String.valueOf(s.charAt(0));
if (s.length() == 1)
return e;
else if (s.length() > 2)
e.operant = String.valueOf(s.charAt(1));
e.tail = parse(s.substring(2));
else
throw new IllegalArgumentException("invalid input " + s);
return e;
public static void main(String[] args) throws Exception
Parser p = new Parser();
Parser.symbol_table.put("a", new Integer(1));
Parser.symbol_table.put("b", new Integer(2));
Parser.symbol_table.put("c", new Integer(3));
Parser.symbol_table.put("d", new Integer(4));
Expression e = p.parse("a|b|c&d");
System.out.println("input " + e.toString());
System.out.println(e.eval(2));
} -
Thanks to all those who responded requesting the Express white paper. I
received an overwhelming response. I was expecting a dozen or so
requests - I received over 80. Apparently there is strong demand for
lessons learned about working with Express.
The paper is in-progress. Everyone that requested it will get it when
it is ready, hopefully before end of September. BTW, my paper on
Express and the Object/Relational Problem will be published by Dr.
Dobb's Journal about that time also - the publisher tells me that the
November issue will be on the newsstands by end of September. The DDJ
article is a review of the basics of Express, what it does, and how
you develop with it. It also includes our early experiences with it
(article was written end of April and reflects almost three month's
experience with Express at that time). The article also goes briefly
over our concept for a rapid process specific to Express. The white
paper will have much more to say on the topic.
Several people thanked me for my generosity in offering a free white
paper and sharing our experiences with the Forte' community. There is
nothing generous about the offer: it is unabashed self-promotion in the
finest tradition of American crass commercialism. We're a consulting
company. We sell our knowledge and experience. If, after you get the
white paper, you would like to retain us on a consulting assignment we
would be very grateful, and you will have a chance to pay us back for
our generosity. If not, maybe you can reciprocate and share your
experiences.
Now to the subject of this posting: why am I posting this now? Well,
for one thing, I received several responses that said something
like: " we've tried Express and we were disappointed with ...", or "we've
been using it and have been frustrated with ...", or "we've evaluated it
and we had difficulties with ...". I started writing reply notes to each
of the individuals who expressed those negative experiences, but when I
reviewed what I wrote, it sounded like a Dear Abby column, with the replies
sounding like: Dear Disappointed, or Dear Frustrated, or Dear With
Difficulties. I decided I'll just post one note for all those who've
had negative experiences, or who are just starting to use/evaluate Express
and are likely to have similar experiences. Hence this. I also felt that
I should give people somewhat of an overview of what's coming in the
white paper while they're waiting to get the finished product.
Perhaps initial difficulties with Express is a problem of unrealistic
expectations. I always try to remember Mick Jagger's words. Mick, as
everyone knows, is one of the great software minds of the 20th century:
"You can't always get what you want ...". You must determine if you're
getting what you need.
Seriously, I have been working on the object/relational "impedance
mismatch problem" for close to ten years now (since 1987 when I
developed an Ada/SQL binding for the US Department of Defense). I have seen
many solutions, and have developed several myself for C,C++,Ada and
for Oracle, Sybase, Informix, and Ingress. I find Express to be one
of the most elegant solutions to that thorny problem. If you look at it from
that point of view alone, it's very hard to fail to be impressed. If you're
expecting Express (or PowerBuilder 5, or any other solution) to be yet another
Silver bullet to slay the development monster then you'll be disappointed.
Software development is hard, will continue to be hard, and will continue
to get more complex. Anything that can help us eliminate or reduce what
Frederick Brooks calls "accidental complexity", and design around "essential
complexity", will help. Forte' and Express definitely do that. Paul
Butterworth's paper on "Managing the New Complexities of Application
Development", shows how Forte' has solved many of the development/deployment
problems. If you haven't read it, I highly recommend it. If you have, I would
recommend a re-read if you've forgotten why you chose Forte' to begin with, or
if you yourself did not participate in making that choice, The Express user's
manual, "Using Forte' Express", shows how Express extends Forte' to reduce
the complexity of developing RDBMS-based systems.
To get an appreciation for what Express does for you, try a simple
experiment : spec out a GUI/RDBMS application, say the order entry application
that comes with Express as a tutorial. Do it without Express. Then do it with
Express. Try to make the application as complete as possible - it must
implement all your business rules and have all the behaviors that you desire.
Relax a bit about look and feel. Also Remember to keep the experiment fair.
As part of your application development come up with a framework and an
architecture that the next application will use. Your non-Express application
also must be as extensible and modifiable as Express allows an Express
project. Record the development time of both. If you can beat Express in
development time, then you're a Forte' development Guru and people should be
beating a path to your door.
Lest anyone think I am a cheerleader for Express, I want to mention that
I have some very strong disagreements with several aspects of the
Express architecture. One major problem I find with it is conceptual.
The Express relational encapsulation has added a great deal of accidental
complexity, i.e complexity that is not inherently there because
of the nature of the problem. It arises because of design or implementation
choices. Express represents each database table with three classes (there is
actually six classes per table, three of which are just derived place holders
to contain customizations, so we'll ignore them for this discussion). For a
table EMP, Express produces three base classes: an EMPClass, an EMPQuery
class, and EMPMgr class. The EMPClass is quite understandable. It
encapsulates the table's data. The EMPMgr class is somewhat understandable,
it encapsulates operations that manage the table's data as it crosses the
interfaces. But why do we need one class per table? A manager should manage
several things, not one thing. That leads us to EMPQuery, the encapsulation
that I have most difficulty with: creating a query class for each table. That
is definitely the wrong abstraction.
If you consider that, in general, a SQL query is multi-table:
select t1.col1, t2.col2, t3.col3, ...
from t1, t2, t3, ..
where <expressions on t1.col1, t2.col2, ...>
order by <expressions on t1.col1, t2.col2, ...>
you'll see that the abstraction here is a query tree across many tables,
many columns, and a large variety of expressions - single and multi-table. To
attempt to encapsulate that in objects that are basically single table objects
will produce a great deal of accidental complexity. The design choice of one
query class per table makes writing one-table queries simple, but writing
multi-table queries awkward.
The Express architecture would be much simpler if there is a QueryTree
class for all tables. Better yet, leave the representation of queries as
text strings - ANSI or Forte' SQL on the client side, and DBMS-specific on the
server side. A great deal of complexity in doing query customizations will
be reduced. You will lose some type checking that the current design has, but
hey, you can't always get what you want. When you have several hundred tables
in your database and Express generates six classes to per table, you'll see
that the number of classes generated as excessive. When you try to design a
general query modification scheme you'll realize how awkward multi-table joins
are to do via the Express BusinessQuery class. Last week I was developing a
general design for row-level security, the query structure drove me crazy,
I ended up catching the generated SQLText and inserting the security
constraints.
Now back to the Dear Abby column: If you're unhappy because of performance
issues, try to isolate the reason for the poor performance. This is not easy
in 3-tier applications. Don't be too quick to blame the bad performance on
Express. Do you have a non-Express benchmark application that does the
same thing and outperforms Express? Don't be too quick to blame Forte'
either. Do you have a non-Forte' benchmark, that does the same things
and outperforms Forte'? The operative words here are "does the same
things". A VB application that issues a SQL Select is not a benchmark.
Forte' allows you to instrument applications to study performance
bottlenecks. Find out where your hot spots are and try to do some design
work. If the Express architecture gets in the way, it's time for feedback
to Express developers.
Performance issues, particularly in 3-tier client/server systems are
multi-faceted and complex. There are many interactions of database
issues, interaction of the database with TOOL language issues, locking,
caching, timing of asynchronous events, shared objects, distributed objects,
remote references, memory allocation/deallocation, message traffic,
copying across partitions, etc. etc. that have to be considered. There
was an interesting discussion just a few days ago on multi-threading
on the client side, and blocking in DBMS APIs. Issues like that can
keep you bogged down for days. I have worked on several performance efforts
on triage tuning teams and swat re-design teams, where several hundred man
hours were dedicated to performance and tuning of c/s systems. Big and
complex topic. What I would advice about performance is what Tom Gilb says:
"(1) don't worry about it, and (2) don't worry about it yet" - assuming of
course that you have a rational design, and a sound framework. Many sins of
design are committed in the name of performance. Anyway, enough
of the harangue about premature considerations of performance. Bottom
line is : once you get your functionality, instrument, measure, and tune. If
your architecture was sound, you won't have to re-design for performance, you
would've designed it in.
On our project the system is so large we are subsumed with rapid process
issues: how can we get this monster finished on time? without having to
expand the team to several times its size, and without having to spend more
than we can afford? The upcoming white paper's focus will be on the rapid
process. Probably at a later date, we'll do another paper on performance
issues with Express.
Another reason you may be unhappy with Express is if you perceive that
it is the wrong tool for your application - but was chosen by
corporate mandate. If your application does not involve an RDBMS (say
real-time process control), then Express is obviously not for you. It may
also appear that Express is not suitable for your application if your usage
of the RDBMS is marginal, but your application logic is quite complex (in our
case the application has many AI aspects to it, a rules-based database, and
many interconnected patterns of rules, and rich behaviors). If you find
you're spending too much time doing things outside Express, fighting
Express, or doing way too many customizations, then Express may
not have been the right choice for your application.
Don't think, however, that Express is only for those applications that
maintain relational base tables. You can use a relational database to
store tables other than base tables (state transition tables, dialog
support tables, views, and other kinds of virtual tables). To make use
of Express's powerful application generating capabilities you can use
tables created for the sole purpose of of supporting an Express
application model. The table is in essence, a state transition
diagram. The Express application model creates rows in this
virtual table while the dialog is in-progress. You can use insert and
update triggers in your SQL engine to do the real thing to your base
tables. This trick is among some I'll detail in the white paper.
Another reason some people may be unhappy with Express may be methodology
tension between those who use behavior-driven methodologies (Booch, Jacobson,
Wirfs-Brock), and those who favor data-driven methodologies (OMT, Coad). If
you're in the first camp, you'll probably feel that the modeling done via
Express is not adequate. You'd probably say "that's not an object model!
that's an ERD". You would be half right - the Express business model shows
only containment and association relationships. It does not document "uses"
relationships, so it really can't be considered a full object-model. Granted;
but once you make that realization, your reaction should be one of joy, not
sadness. This is a brilliant reduction in the amount of modeling that needs
to be done since most MIS systems are dominated by their data-model, not their
behavior model (See Arthur Riel's Design Heuristics) . Behavior-based methodologies,
with their documentation of use-cases and class behavior will tend to be analysis
overkill for most MIS projects. For some OOA/OOD practitioners, going back to a
data-centered process may be unpalatable. For those folks my advice would be to try to
look at the business model/application models as meta-models. Take the
generated classes and produce a full object model if you wish. Document your
domain classes in your favorite CASE tool. By all means document
domain-pertinent behavior and use-cases, they will help you test. But do
appreciate the productivity gain produced by the reduction of modeling load
that Express data-centered approach gives you. Your detailed
behavior-based, use-case model may be a luxury you can't afford.
If the methodology clash manifests itself politically in your
organization, where you have the OO purists pooh-pooh a data centered
approach, then you have my sympathies. My best advice is to cool it on the
methodology religion front. If you have a product to deliver, you can't
afford it. Also keep in mind that even if your modeling work is reduced by
adopting a data-centered Express process, you'll still have ample
opportunities to fully utilize your OOD expertise when it comes time to add
functionality or improve performance of the entire application as a whole.
There will still be processes where Express may not be expressive enough. Those
processes whose behavior is so rich and intricate that you cannot find a
data-based trick to model them with, you'd have to do outside Express. These
should be rare and the exception not the rule in MIS systems, however.
Does that exhaust the list of reasons of why people may be
disappointed in Express? Probably not. Undoubtedly Express reduces your
degrees of freedom, and constrains your choices, but many times "jail
liberates". More reasons? I've heard some complaints about repository
corruption problems. I'm not aware that we've had those, or that it is
something due to Express. I'll check with our Forte' system manager. If we
have, they must not have been show stoppers, and our system manager must
have dealt with them quickly enough that the developers did not notice much.
Until you get the full paper in a few weeks, I'll leave you with some
thoughts about Express, and OO development in general:
1. Learn about the concept of "Good enough" in software
engineering. Here are some sources:
- Ed Yourdon: Read Ed Yourdon's article in the last issue of Byte,
titled "When Good Enough is Best". One of Yourdon's tips in the
article: "It's the Process, Stupid!"
Don't take "good enough" to mean that development with Express
requires you to lower your expectations, or lower your
standards. You must tune the concept of "good enough" to your
acceptable standards.
- Arthur Riel: Read Arthur Riel's great book "Object-Oriented Design
Heuristics". Riel shows that there are many problems with no optimal
solutions. This is particularly true in those systems that
are not purely object oriented. Systems that interface with
non-object oriented "legacy" systems, which is what Express
is. Also, Riel's discussion of behavior-based vs data-based
methodologies is very illuminating.
2. Don't obsess about look and feel. That's where Express is most
constraining. If you have unique look and feel requirements,
and look and feel is paramount to you, save yourself some pain and
choose another tool, or sing along with Mick: you can't always get
you want ...
3. Be clear about what rapid development really means. An excellent
resource is the book by Steve McConnell of Microsoft: "Rapid
Development - Taming Wild Software Schedules". A thick book, but the
chapters on best practices, and the tens of case studies are great. The
book shows clearly the differences between evolutionary
delivery, and staged delivery. It shows the differences between
evolutionary prototyping, throwaway prototyping, user-interface
prototyping, and demonstration prototyping and the appropriate uses
and risks of each. In our white paper we advocate a life cycle
approach that is basically evolutionary prototyping, with evolutionary
delivery, and occasional use of throwaway prototypes. We don't advocate
using Express for demonstration prototyping.
4. Realize that Express is maturing along with the product you're
developing. If you don't have deep philosophicalobjections to the
Express framework and architecture, then most of
the concerns with Express would be temporary details that will be
smoothed as Express, and Forte', mature. How long did we wait for
Windows to mature? Let's be fair to the Express developers.
5. The main keys to success in Express are not rocket science (I
worry now about having hyped up people's expectations myself). The
major keys to success revolve around management issues, not
technical issues: expectations management, process management,
and customizations management.
The full paper includes the design and implementation of a Customizations
Management System that allows you to plan customizations needed and to
inventory customizations completed. It automates the process of
extracting the customizations completed from the repository and stores
them in a relational database. A customizations browser then allows
management to plan and prioritize the implementation of customizations. It
allows developers to study the completed customizations and to reuse code,
design, or concepts to implement further customizations. Managing
customizations is absolutely essential for success in Express. The paper
will also detail a rapid process that is "Express friendly".
I'm glad there was such a big response to the white paper offer. Now I have
to sit down and write it!
Nabil Hijazi Optimum Solutions, Inc.
[email protected] 201 Elden Street
Phone: (703) 435-3530 #501
Fax: (703) 435-9212 Herndon, Va 22070
================================================
You can't always get what you want.
But if you try sometime, you might find,
you get what you need. Mick Jagger.
------------------------------------------------[email protected] wrote:
>
A few comments on Nabil Hijazi's observations...
Nabil Hijazi writes...
One major problem I find with it is conceptual.The Express relational
encapsulation has added a great deal of accidental complexity, i.e complexity
that is not inherently there because of the nature of the problem. It arises
because of design or implementation choices.
Paul Krinsky comments...
Anyone who has used NeXT's Enterprise Object Framework (EOF) will be at home
with Express's architecture, it is very similar. NeXT has been around for a
while and have gone through a lot. They originally started with DBKit to solve
the persistence problem. Basically it wrappered the database libraries. EOF was
created when it became clear that the DBKit approach wouldn't work. EOF has
EO's (Enterprise Objects), EOQuery, EOController, etc. that do pretty much what
BusinessClass, BusinessQuery and BusinessMgr do. I'm not sure if Forte hired
people with NeXT experience, but it would be interesting to find out if both
companies came up with the same architecture independently. What are the
chances?
Nabil Hijazi writes...
The design choice of one query class per table makes writing one-table queries
simple, but writing multi-table queries awkward.
Paul Krinsky comments...
I don't think BusinessQuery is too bad once you get used to it. Multi-table
queries are pretty easy if you use the foreign attributes Express provides to
build connected queries. One feature I miss from EOF is the EOFault. An EOFault
stands in for an object to reduce the overhead of retrieving everything an
object has a pointer to. For example, a retrieve on customer that contains an
array of orders would bring in EOFaults to stand in for the orders. When one of
the orders was referenced, EOF would produce a fault (hence the name) and go
and get the required record. Of course you could force EOF to bring the real
data and not use EOfaults if you wanted (if chance were high that you would
need it). This feature saved a lot of memory and increased the speed of
retrieval while still providing transparent access from the viewpoint of the
developer. Another cool feature was uniquing. EOF kept track of the EOs it
retrieved for a client. So if two windows both retrieved Customer X, EOF would
realize this and point the 2nd window at the copy already in memory. This
avoided having multiple copies of the same object in memory and allowed
provided everyone with the most current changes.
Nabil Hijazi writes...
The Express architecture would be much simpler if there is a QueryTree
class for all tables. Better yet, leave the representation of queries as text
strings - ANSI or Forte' SQL on the client side, and DBMS-specific on the
server side. A great deal of complexity in doing query customizations will be
reduced. You will lose some type checking that the current design has, but hey,
you can't always get what you want. When you have several hundred tables in
your database and Express generates six classes to per table, you'll see that
the number of classes generated as excessive. When you try to design a general
query modification scheme you'll realize how awkward multi-table joins are to
do via the Express BusinessQuery class. Last week I was developing a general
design for row-level security, the query structure drove me crazy, I ended up
catching the generated SQLText and inserting the security constraints.
Paul Krinsky comments...
I like the fact that Express manages the mapping to the database. I can change
the underlying database schema and all my queries still work. When the DBAs
inform me that I'm not following their naming standard (remove all vowels
except for 207 "standard" abbreviations that somehow got blessed then compress
to 8 characters using a bit compression algorithm that NASA would be proud of -
am I ranting?) it lets me conform without having to deal with it except in the
business model. It's nice to have a layer of abstraction.
I'm not a big fan of having all the generated classes either. I think it's a
necessary evil because of TOOL. NeXT uses Objective-C which is much more
dynamic in nature (more in common with Smalltalk than C). Their business model
can be defined on the fly and changed at runtime. It's pretty powerful but you
always have the speed vs. size tradeoff. The BusinessQuery is a nice way to
send only the what you need to the server in a format that isn't too difficult
to translate to SQL but not so close to SQL that you couldn't rip out the
backend and use the same interface to communicate with something other than a
relational database.
With any tool you have to understand it's strengths and weaknesses. Express is
a 1.0 product. Given that I think they have done a great job. The biggest
request I have is that Express moves away from being so focused on UI and
Database access and focus more on the BusinessClasses. For example, why are the
Validate and NewObject methods not on the BusinessClass? I understand their
importance in the Window classes but they should really delegate most of the
work to the BusinessClass. Otherwise you end up with most of the logic in the
UI and a 2-tier application. One of the first things we did is extend the
Window classes to delegate validation, etc. to the classes they display.Paul,
This a very good point. After reviewing all the customizations we have done on
our Express project, (BTW, I work with Nabil) I found that we have not done any
business service customizations except for database row level security. We could
have easily moved validation to the business classes. Actually, Express gives you examples
for this. They recommend customizing the insert and update methods to apply validation.
You could simply add your own validate method on the business class and have the insert,
update, or the window call it. This is actually much more object oriented than coding
validation into the window classes (for the oo purest out there!).
Robert Crisafulli
AMISYS Managed Care Solutions Inc.
(301) 838-7540
>
I look forward to reading the white paper on Express. I would encourage anyone
else to post similar documents. If anyone is interested, I can dig up some
stuff I wrote on EOF's architecture. It's a good source for enhancement
requests if nothing else! If anyone has used other persistence frameworks I
think the group would benefit from their experiences.
Paul Krinsky
Price Waterhouse LLC
Management Consulting Group -
To access a method frm a class derived frm a base class with the same name
Here' s an example:-
class TestA {
public void start() {
System.out.println("TestA");
class TestB extends TestA {
public void start() {
System.out.println("TestB");
}In main method I do this:-
TestA testA = new TestA();
TestB testB = new TestB();
((TestA)testB).start();Output :-
TestB.
Now when i define the method as static :-
class TestA {
public static void start() {
System.out.println("TestA");
class TestB extends TestA {
public static void start() {
System.out.println("TestB");
}Then output is :-
TestA.
Can anyone let me know that when i say ((TestA)testB).start(); i.e i am type casting TestB obect to it base call then TestA should be printed but it doesn't print but when i declare method as static is does print TestA.
Thanks,
Heena>
>
Secondly, when i say ((TestA).testB).start(); output is TestB. But when i define start() method as static output is TestA. I need clarity for the same.In the static case, all that the compiler is interested in is the class of the expression before the ".". Because you've put in an explicit cast the type of expression is assumed to be TestA the compiler doesn't know what kind of object will actually be referenced at runtime. In the static case which method is called is determined at compile time.
In the instance method case what determines the method called is determined the class of the actual, run time, value of the expression, and despite your cast, the actual value is still a reference to a TestB instance, so the TestB method is called. In the instance case which method called is determined at run time. -
Error using Filter with SQL Expression
Hey all -
New to Oracle BI, and getting a problem with Filters that use SQL Expressions.
The column I'm filtering on is a 4 digit year, expressed as a VARCHAR2(4 byte) in the physical database. My SQL Expression in the filter is:
Column: CAL YEAR 4 DIGIT
Operator: Is equal to/in
SQL Expression: TO_CHAR(ADD_MONTHS(SYSDATE, -24), 'YYYY'))
when I click on the "Results" Tab I get the following error message:
Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Odbc driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] . (HY000)
I've isolated the issue to the expression above. If I put in a literal value and supply a four digit year like below it works:
Column: CAL YEAR 4 DIGIT
Operator: Is equal to/in
SQL Expression: *2008*
Any ideas on what's causing my problem?
Thanks!
Macmacearl wrote:
SQL View does not display unless data is returned by the query. Is that normal?
Also, none of these options shows the literal result of the expression we built, i.e.:
expression: CAST(YEAR(TIMESTAMPADD(SQL_TSI_MONTH, -24, CURRENT_DATE)) as CHAR)
result: *2008*
Having the ability to test expressions and see their results would be very helpful in debugging. If anyone knows how to do that please share!
Thanks!
MacOk, Probably shoud have figured this out before, but in response to my own question, the way to view the result of an expression is to add the expression as a column and include it in the Table Presentation.
- Mac (he can be taught) -
Binding definition error with programmed binding classes
Hi all,
640/NW04s/ECC5 SP14 system, I'm trying to use a programmed container->container binding class.
I've created my class implementing interface IF_SWF_IFS_BIND_TRANSFORM_CONT, but when I try to put it into the binding editor, it complains with:
SWF_BND_001/100: Error when executing binding operaton 'CNT'
I've tried all sorts, even gone as far as implementing the presentation interface and giving it a little icon in the binding editor (nice touch!).
Looks nice, but still no joy so back to basics: I figured to make sure there's no problem with my code I created two completely empty classes, one for Expression->Expression binding and one for Container->Container binding. The binding editor is happy with the expression binding class, but still gives the same message about the container binding class.
No luck with any notes on OSS, any input welcome...
Cheers
Mike
(Cross-posted to SAP-WUG and SDN-BPM)Hi
I have had the same problem but if you tick the checkbox handle error as warning
it works. Now I will try to code and see the results...
this workflow is very heavy tool... -
Accessing inner protected class with .new
My weak understanding is that inner classes are no different in terms of access modification as other class members, thus I was expecting the following to compile:
package A;
public class ClassA {
protected void protectedMethod() {}
protected class ProtectedInnerClass {}
}is being used over here in package B
package B;
import A.*;
public class ClassB extends ClassA {
public static void main(String[] args) {
ClassB b = new ClassB();
b.protectedMethod(); // works fine. I am inheriting ClassA and calling the protected method.
ClassB.ProtectedInnerClass c = b.new ProtectedInnerClass(); // compiler error: ProtectedInnerClass is protected
}Why can I not access the protected inner class when ClassB is inheriting it as is the case with the protected method?
thanks in advance!So classes that inherit other classes with protected inner classes will not be able to instantiate these inner classes regardless of the inheritance relationship.No, that's not true. Example:
package A;
public class ClassA {
protected void protectedMethod() {
protected class ProtectedInnerClass { // class is protected
public ProtectedInnerClass() { } // <-- nota bene
package B;
import A.ClassA;
public class ClassB extends ClassA {
public static void main(String[] args) {
ClassB b = new ClassB();
b.protectedMethod(); // works fine.
ClassB.ProtectedInnerClass c = b.new ProtectedInnerClass(); // works fine, too.
}It's section 6.6.2.2 that describes this behavior, as I quoted above. The last bullet point of that section reads (to repeat): "A protected constructor can be accessed by a class instance creation expression (that does not declare an anonymous class) only from within the package in which it is defined."
~ -
Howto instatiate array of inner classes
Hi, I couldn't find the syntax for doing this.
I just want to instantiate an array of inner classes (non-static). It says '(' expected.
Here is a small sample:
public class test_inner {
public class inner1 {
public inner1 inner1_inst;
public class inner2 {
public inner2[] inner2_ar;
public static void foo() {
test_inner inst = new test_inner(); // OK
inst.inner1_inst = inst.new inner1(); // OK, single inst
inst.innter2_ar = inst.new inner2[10]; // fails to compile
// also tried [10]() even ()[10] ...
Using java 1.6 Win32.
As always grateful for any help.The following compiles OK:public class test_inner {
public class inner1 {}
public inner1 inner1_inst;
public class inner2 {}
public inner2[] inner2_ar;
public static void foo() {
test_inner inst = new test_inner();
inst.inner1_inst = inst.new inner1();
inst.inner2_ar = new test_inner.inner2[10];
// inst.inner2_ar = inst.new inner2[10]; // fails to compile
// also tried [10]() even ()[10] ...
}When creating inst.inner2_ar you don't use a qualified class instance creation expression (JLS 15.9) because what is being created is not an inner member class: it's an array. So the syntax for creating it is that of JLS 15.10. -
Non serializable class in biztalk
Is it possible to have a non serializable class in a biztalk application?
ChristianeHi Christiane,
Yes, it can be used in orchestration but in an atomic scope only.
Steps to call a Non-Serializable .NET Helper Class inside an Expression Shape(The DLL that contains the class must be strongly signed and placed in the GAC):
1.Add a reference to that class.
2.Add an Atomic scope.
3.Create an Orchestration variable of that class inside the scope.
4.Create an instance on that object inside the scope.
5.Call the method.
Maheshkumar S Tiwari|User Page|Blog|BizTalk
Server : How Map Works on Port Level -
Handling Regular expression ambiguitie s
Hi All,
I am attemting to make my own regular expression class. (Just for fun) :)
I have successfully converted the regular expression into a DFA ( deterministic finite automaton ). However, as i have noticed, there is still ambiguity in transition when it comes to certain classes of regular expressions such as a+[^0-9]+w. this means one or more a's followed by one or more symbols that are NOT numbers, followed by a w. Now if we have a string "aaaw", the first a is matched quite nicely, but should the second 'a' be treated as an a that is to be matched with "a+" or "[^0-9]" ??
Is there any algorithm that resloves such an ambiguity?
Any help would be much appreciated. I am stuck with this issue and don't seem to have any leads at all :)Hi All,
My problem is now solved. I have refined the suggestions to come up with the following algorithm ( excuse the errors, and ineffeciencies, if any )
push all DFA states into a queue
while !(dfaStateQueue.empty())
currentDFAState = dfaStateQueue.pop()
push all transitions of currentDFAState to transitionQueue.
store all transitions into transitionArray.
while ( !transitionQueue.empty() )
compareWithTransition = transitionQueue.pop();
for(i = 1 to length(transitionArray) )
compareWithTransition = transitionArray;
Set intersec = set_intersection(compareWithTransition.getChars, compareToTransition.getChars);
if( !intersect.empty() )
//characters in compareWith but not in compareTo
Set minus1 = set_difference(compareWithTransition, compareToTransition)
//characters in compareTo but not in compareWith.
Set minus2 = set_difference(compareToTransition, compareWithTransition)
//compareWithTransition is subset of compareToTransition
if(minus1.empty())
replace characters of compareTo with characters in set minus2
replace characters of a closure transition of compareTo
with characters in set minus2
compareWithTransition.nextDfa.addAllTransitions
(compareToTransition.nextDfa.getTransitions())
continue
//compareToTransition is subset of compareWithTransition
else if(minus2.empty())
replace characters of compareWithTransition with characters in set minus1
replace characters of a closure transition of compareWithTransition
with characters in set minus2
compareToTransition.nextDfa.addAllTransitions
(compareWithTransition.nextDfa.getTransitions())
continue;
end if
create new DFA state D;
currentDFAState.addTransition(intersect, D);
push D onto queue.
D.addAllTransitions(compareWithTransition.nextDfa.getTransitions());
D.addAllTransitions(compareToTransition.nextDfa.getTransitions());
replace characters of compareWithTransition with characters in set minus1
replace characters of compareToTransition with characters in set minus2
end if
end for
end while
end while
I hope this helps everyone at large. Now there is no need for backtracking at all and DFAs are now truly "DFAs" :)
I dont know if other tools employ this technique or not. Please ignore the glaring ineffeciencies. I have give the algorithm the way i coded it ( Never considered myself as effecient programmer in the first place) HAHAHA
Chears,
AUTOMATON -
How can I use Drap and Drop in Linux system?
I try to use DnD in a item from "explorer" in Linux into my application, but it does atually not work. The same version is work well on Windows. Below is code (3 separated files):
* FileAndTextTransferHandler.java is used by the 1.4
* DragFileDemo.java example.
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
class FileAndTextTransferHandler extends TransferHandler {
private DataFlavor fileFlavor, stringFlavor;
private TabbedPaneController tpc;
private JTextArea source;
private boolean shouldRemove;
protected String newline = "\n";
//Start and end position in the source text.
//We need this information when performing a MOVE
//in order to remove the dragged text from the source.
Position p0 = null, p1 = null;
FileAndTextTransferHandler(TabbedPaneController t) {
tpc = t;
fileFlavor = DataFlavor.javaFileListFlavor;
stringFlavor = DataFlavor.stringFlavor;
public boolean importData(JComponent c, Transferable t) {
JTextArea tc;
if (!canImport(c, t.getTransferDataFlavors())) {
return false;
//A real application would load the file in another
//thread in order to not block the UI. This step
//was omitted here to simplify the code.
try {
if (hasFileFlavor(t.getTransferDataFlavors())) {
String str = null;
java.util.List files =
(java.util.List)t.getTransferData(fileFlavor);
for (int i = 0; i < files.size(); i++) {
File file = (File)files.get(i);
//Tell the tabbedpane controller to add
//a new tab with the name of this file
//on the tab. The text area that will
//display the contents of the file is returned.
tc = tpc.addTab(file.toString());
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
while ((str = in.readLine()) != null) {
tc.append(str + newline);
} catch (IOException ioe) {
System.out.println(
"importData: Unable to read from file " +
file.toString());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ioe) {
System.out.println(
"importData: Unable to close file " +
file.toString());
return true;
} else if (hasStringFlavor(t.getTransferDataFlavors())) {
tc = (JTextArea)c;
if (tc.equals(source) && (tc.getCaretPosition() >= p0.getOffset()) &&
(tc.getCaretPosition() <= p1.getOffset())) {
shouldRemove = false;
return true;
String str = (String)t.getTransferData(stringFlavor);
tc.replaceSelection(str);
return true;
} catch (UnsupportedFlavorException ufe) {
System.out.println("importData: unsupported data flavor");
} catch (IOException ieo) {
System.out.println("importData: I/O exception");
return false;
protected Transferable createTransferable(JComponent c) {
source = (JTextArea)c;
int start = source.getSelectionStart();
int end = source.getSelectionEnd();
Document doc = source.getDocument();
if (start == end) {
return null;
try {
p0 = doc.createPosition(start);
p1 = doc.createPosition(end);
} catch (BadLocationException e) {
System.out.println(
"Can't create position - unable to remove text from source.");
shouldRemove = true;
String data = source.getSelectedText();
return new StringSelection(data);
public int getSourceActions(JComponent c) {
return COPY_OR_MOVE;
//Remove the old text if the action is a MOVE.
//However, we do not allow dropping on top of the selected text,
//so in that case do nothing.
protected void exportDone(JComponent c, Transferable data, int action) {
if (shouldRemove && (action == MOVE)) {
if ((p0 != null) && (p1 != null) &&
(p0.getOffset() != p1.getOffset())) {
try {
JTextComponent tc = (JTextComponent)c;
tc.getDocument().remove(
p0.getOffset(), p1.getOffset() - p0.getOffset());
} catch (BadLocationException e) {
System.out.println("Can't remove text from source.");
source = null;
public boolean canImport(JComponent c, DataFlavor[] flavors) {
if (hasFileFlavor(flavors)) { return true; }
if (hasStringFlavor(flavors)) { return true; }
return false;
private boolean hasFileFlavor(DataFlavor[] flavors) {
for (int i = 0; i < flavors.length; i++) {
if (fileFlavor.equals(flavors)) {
return true;
return false;
private boolean hasStringFlavor(DataFlavor[] flavors) {
for (int i = 0; i < flavors.length; i++) {
if (stringFlavor.equals(flavors[i])) {
return true;
return false;
* TabbedPaneController.java is used by the 1.4
* DragFileDemo.java example.
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
* Class that manages area where the contents of
* files are displayed. When no files are present,
* there is a simple JTextArea instructing users
* to drop a file. As soon as a file is dropped,
* a JTabbedPane is placed into the window and
* each file is displayed under its own tab.
* When all the files are removed, the JTabbedPane
* is removed from the window and the simple
* JTextArea is again displayed.
public class TabbedPaneController {
JPanel tabbedPanel = null;
JTabbedPane tabbedPane;
JPanel emptyFilePanel = null;
JTextArea emptyFileArea = null;
FileAndTextTransferHandler transferHandler;
boolean noFiles = true;
String fileSeparator;
public TabbedPaneController(JTabbedPane tb, JPanel tp) {
tabbedPane = tb;
tabbedPanel = tp;
transferHandler = new FileAndTextTransferHandler(this);
fileSeparator = System.getProperty("file.separator");
//The split method in the String class uses
//regular expressions to define the text used for
//the split. The forward slash "\" is a special
//character and must be escaped. Some look and feels,
//such as Microsoft Windows, use the forward slash to
//delimit the path.
if ("\\".equals(fileSeparator)) {
fileSeparator = "\\\\";
init();
public JTextArea addTab(String filename) {
if (noFiles) {
tabbedPanel.remove(emptyFilePanel);
tabbedPanel.add(tabbedPane, BorderLayout.CENTER);
noFiles = false;
String[] str = filename.split(fileSeparator);
return makeTextPanel(str[str.length-1], filename);
//Remove all tabs and their components, then put the default
//file area back.
public void clearAll() {
if (noFiles == false) {
tabbedPane.removeAll();
tabbedPanel.remove(tabbedPane);
init();
private void init() {
String defaultText =
"Select one or more files from the file chooser and drop here...";
noFiles = true;
if (emptyFilePanel == null) {
emptyFileArea = new JTextArea(20,15);
emptyFileArea.setEditable(false);
emptyFileArea.setDragEnabled(true);
emptyFileArea.setTransferHandler(transferHandler);
emptyFileArea.setMargin(new Insets(5,5,5,5));
JScrollPane fileScrollPane = new JScrollPane(emptyFileArea);
emptyFilePanel = new JPanel(new BorderLayout(), false);
emptyFilePanel.add(fileScrollPane, BorderLayout.CENTER);
tabbedPanel.add(emptyFilePanel, BorderLayout.CENTER);
tabbedPanel.repaint();
emptyFileArea.setText(defaultText);
protected JTextArea makeTextPanel(String name, String toolTip) {
JTextArea fileArea = new JTextArea(20,15);
fileArea.setDragEnabled(true);
fileArea.setTransferHandler(transferHandler);
fileArea.setMargin(new Insets(5,5,5,5));
JScrollPane fileScrollPane = new JScrollPane(fileArea);
tabbedPane.addTab(name, null, (Component)fileScrollPane, toolTip);
tabbedPane.setSelectedComponent((Component)fileScrollPane);
return fileArea;
* DragFileDemo.java is a 1.4 example that
* requires the following file:
* FileAndTextTransferHandler.java
* TabbedPaneController.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class DragFileDemo extends JPanel
implements ActionListener {
JTextArea fileArea;
JFileChooser fc;
JButton clear;
TabbedPaneController tpc;
public DragFileDemo() {
super(new BorderLayout());
fc = new JFileChooser();;
fc.setMultiSelectionEnabled(true);
fc.setDragEnabled(true);
fc.setControlButtonsAreShown(false);
JPanel fcPanel = new JPanel(new BorderLayout());
fcPanel.add(fc, BorderLayout.CENTER);
clear = new JButton("Clear All");
clear.addActionListener(this);
JPanel buttonPanel = new JPanel(new BorderLayout());
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
buttonPanel.add(clear, BorderLayout.LINE_END);
JPanel upperPanel = new JPanel(new BorderLayout());
upperPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
upperPanel.add(fcPanel, BorderLayout.CENTER);
upperPanel.add(buttonPanel, BorderLayout.PAGE_END);
//The TabbedPaneController manages the panel that
//contains the tabbed pane. When there are no files
//the panel contains a plain text area. Then, as
//files are dropped onto the area, the tabbed panel
//replaces the file area.
JTabbedPane tabbedPane = new JTabbedPane();
JPanel tabPanel = new JPanel(new BorderLayout());
tabPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
tpc = new TabbedPaneController(tabbedPane, tabPanel);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
upperPanel, tabPanel);
splitPane.setDividerLocation(400);
splitPane.setPreferredSize(new Dimension(530, 650));
add(splitPane, BorderLayout.CENTER);
public void setDefaultButton() {
getRootPane().setDefaultButton(clear);
public void actionPerformed(ActionEvent e) {
if (e.getSource() == clear) {
tpc.clearAll();
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("DragFileDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the menu bar and content pane.
DragFileDemo demo = new DragFileDemo();
demo.setOpaque(true); //content panes must be opaque
frame.setContentPane(demo);
//Display the window.
frame.pack();
frame.setVisible(true);
demo.setDefaultButton();
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();I'm currently using Linux Fedora system.
Doesn't matter. There's no standard way for D&D on Linux, no single API.
Every application has its own mechanism which may or may not be compatible with any other.
Gnome and KDE groups are doing some work to provide a common standard but as you know the Linux zealots are completely opposed to anyone telling them what to do (such as creating standards) and won't in general follow them. -
Date picker for af:inputDate is not picking up the correct input date
view source:
<af:inputDate value="#{bindings.DateField.attributeValue}" label="#{bindings.DateField.hints.label}"
required="#{bindings.DateField.hints.mandatory}"
valueChangeListener="#{pageFlowScope.CollectApplicantInformation.datesItemChanged}"
columns="#{bindings.DateField.hints.displayWidth}" shortDesc="#{CustomTooltip[DateField]}"
autoSubmit="true" helpTopicId="AppDt" id="DateField" simple="true">
<f:validator binding="#{bindings.DateField.validator}"/>
*<f:converter converterId="CustomConverter"/>*
</af:inputDate>
Here I am not using <af:ConvertDateTime> insted using customConverter, so what code changes do I need to make sure the date picker always picks the already existind date in the inputDate rather picking the current date?
Here is my CustomConverter.java
CustomConverter.java
public class CustomConverter extends DateTimeConverter implements ClientConverter, Converter
public Object getAsObject(FacesContext context, UIComponent component, String value)
String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
if (dataType != null && !dataType.equalsIgnoreCase("oracle.jbo.domain.Date") && !dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
String test = null;
if (context == null || component == null)
throw new NullPointerException();
if (value != null)
// To solve DB transaction dirty issue, Check isEmpty and return null.
if (value.isEmpty())
return null;
// the "value" is stored on the value property of the component.
// The Unified EL allows us to check the type
ValueExpression expression = component.getValueExpression("value");
if (expression != null)
Class<?> expectedType = expression.getType(context.getELContext());
if (expectedType != null)
System.out.println("expectedType Value:::" + expectedType.getName());
// try to convert the value (Object) to the TYPE of the "value" property
// of the underlying JSF component
try
return TypeFactory.getInstance(expectedType, value);
catch (DataCreationException e)
String errorMessage;
if (expectedType.equals(CustomNumber.class))
errorMessage = "You can enter only Numbers in this field";
else
errorMessage = e.getMessage();
if (errorMessage != null)
FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Format" , errorMessage);
ctx.addMessage(component.getClientId(), fm);
catch (CustomDomainException e)
int errorCode = e.getErrorMessageCode();
String[] errorMessage = e.getErrorMessageParams();
if (errorCode == 7 && errorMessage != null)
String msg = "Invalid " + errorMessage[0];
FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application Error: ", msg);
ctx.addMessage(component.getClientId(), fm);
catch (JboException e)
Throwable cause = e.getCause();
if (cause == null)
cause = e;
test = "not good format";
throw e;
return null;
else
return value != null? value: null;
public String getAsString(FacesContext context, UIComponent component, Object value)
return value != null? value.toString(): null;
public String getClientLibrarySource(FacesContext context)
return null;
@Override
public Collection<String> getClientImportNames()
return Collections.emptySet();
@Override
public String getClientScript(FacesContext context, UIComponent component)
String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
if (formatMask != null)
String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
if (component == null)
_LOG.severe("The component is null, but it is needed for the client id, so no script written");
return null;
// Add a JavaScript Object to store the datefield formats
// on the client-side. We currently store the format string
// for each and every field. It'd be more efficient to have
// an array of formats, then store for each field the
// index of the format, especially if we could delay outputting
// these objects to when the <form> closes.
String clientId = component.getClientId(context);
if (clientId != null)
// =-=AEW Only if Javascript...
Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
// this fetch could be at the place where we append, but has been
// moved ahead to optimize use of StringBuilder
String jsPattern = getJSPattern(context, component);
String loc = _getLocaleString(context);
// FIX - figure out size!!!
// 127 chars for javascript + length of jspattern + locale + 12 chars for
// tranforming to name in the worst case.
StringBuilder buff = new StringBuilder(139 + jsPattern.length() + loc.length());
if (requestMap.get(_PATTERN_WRITTEN_KEY) == null)
requestMap.put(_PATTERN_WRITTEN_KEY, Boolean.TRUE);
// only create the _dfs object if it doesn't exist, so we don't
// wipe out _dfs[xxx] values if we ppr the first date field on a
// page with multiple date fields.
buff.append("if(window['_dfs'] == undefined){var _dfs=new Object();}if(window['_dl'] == undefined){var _dl=new Object();}");
buff.append("_dfs[\"");
buff.append(clientId);
buff.append("\"]=");
buff.append(jsPattern);
buff.append(";");
buff.append("_dl[\"");
buff.append(clientId);
buff.append("\"]=");
buff.append(loc);
buff.append(";");
return buff.toString();
else
LOG.severe("NULLCLINET_ID_NO_SCRIPT_RENDERED");
return null;
else
return null;
else
return null;
private String _getLocaleString(FacesContext context)
Locale dateTimeConverterLocale = getLocale();
if (dateTimeConverterLocale != null)
Locale defaultLocale = RenderingContext.getCurrentInstance().getLocaleContext().getFormattingLocale();
if (!(dateTimeConverterLocale.equals(defaultLocale)))
String loc = dateTimeConverterLocale.toString();
StringBuffer sb = new StringBuffer(2 + loc.length());
sb.append("'");
sb.append(loc);
sb.append("'");
return (sb.toString());
return "null";
@Override
@Deprecated
public String getClientConversion(FacesContext context, UIComponent component)
String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
if (formatMask != null)
String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
String jsPattern = getJSPattern(context, component);
Map<String, String> messages = new HashMap<String, String>();
if (jsPattern != null)
Class<?> formatclass = formatMask.getClass();
System.out.println("FormatClass::" + formatclass);
System.out.println(" Format Mask : " + formatMask);
// SimpleDateFormat sdfDestination = new SimpleDateFormat(formatMask);
String pattern = formatMask; //getPattern();
if (pattern == null)
pattern = getSecondaryPattern();
String key = getViolationMessageKey(pattern);
Object[] params = new Object[]
{ "{0}", "{1}", "{2}" };
Object msgPattern = getMessagePattern(context, key, params, component);
//if hintFormat is null, no custom hint for date, time or both has been specified
String hintFormat = _getHint();
FacesMessage msg = null;
String detailMessage = null;
if (msgPattern != null)
msg = MessageFactory.getMessage(context, key, msgPattern, params, component);
detailMessage = XhtmlLafUtils.escapeJS(msg.getDetail());
Locale loc = context.getViewRoot().getLocale();
SimpleDateFormat formatter = new SimpleDateFormat(pattern, loc);
java.lang.Object obj = resolveExpression("#{bindings." + component.getId() + ".attributeValue}");
String databaseDate=null;
if(obj!=null)
databaseDate = obj.toString();
DateFormat df = new SimpleDateFormat(pattern,loc);
System.out.println("DateComponent input value :::::::::::::::::::::::::"+databaseDate);
Date today;
try {
// System.out.println("Before Conversion::::::::::::"+df.parse(databaseDate).toString());
if(databaseDate!=null)
today = df.parse(databaseDate);
else
today = new Date();
System.out.println("After Conversion Date :::::::::::::::::::::::::::::"+today.toString());
//Date today = new Date();
String dt = formatter.format(today);
String exampleString = dt;
String escapedType = XhtmlLafUtils.escapeJS(getType().toUpperCase());
StringBuilder outBuffer = new StringBuilder();
outBuffer.append("new TrDateTimeConverter(");
outBuffer.append(jsPattern);
// loc = getLocale();
if (loc != null)
outBuffer.append(",'");
outBuffer.append(loc.toString());
outBuffer.append("','");
else
outBuffer.append(",null,'");
outBuffer.append(exampleString);
outBuffer.append("','");
outBuffer.append(escapedType);
outBuffer.append("'");
if (msgPattern != null || hintFormat != null)
messages.put("detail", detailMessage);
messages.put("hint", hintFormat);
outBuffer.append(',');
// try
// JsonUtils.writeMap(outBuffer, messages, false);
// catch (IOException e)
// outBuffer.append("null");
outBuffer.append(')'); // 2
return outBuffer.toString();
catch(ParseException e)
System.out.println("Parse Exception :::::::::::::::::::::"+e);
return null;
else
// no pattern-matchable date
return null;
else
return null;
else
return null;
protected String getJSPattern(FacesContext context, UIComponent component)
String jsPattern = null;
String datePattern = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
if (datePattern != null)
String secondaryPattern = getSecondaryPattern();
if (datePattern != _NO_JS_PATTERN)
int length = datePattern.length() * 2 + 2;
if (secondaryPattern != null)
length = length + 3 + secondaryPattern.length() * 2;
StringBuilder outBuffer = new StringBuilder(length);
jsPattern = _getEscapedPattern(outBuffer, datePattern, secondaryPattern);
else
jsPattern = datePattern;
return jsPattern;
private static void _escapePattern(StringBuilder buffer, String pattern)
buffer.append('\'');
XhtmlUtils.escapeJS(buffer, pattern);
buffer.append('\'');
private static String _getEscapedPattern(StringBuilder buffer, String pattern, String secondaryPattern)
if (secondaryPattern != null)
buffer.append('[');
_escapePattern(buffer, pattern);
if (secondaryPattern != null)
buffer.append(",'");
XhtmlUtils.escapeJS(buffer, secondaryPattern);
buffer.append("']");
return buffer.toString();
private String _getHint()
String type = getType();
if (type.equals("date"))
return getHintDate();
else if (type.equals("both"))
return getHintBoth();
else
return getHintTime();
public static Object resolveExpression(String pExpression)
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp = null;
valueExp = elFactory.createValueExpression(elContext, pExpression, Object.class);
return valueExp.getValue(elContext);
private static final String _NO_JS_PATTERN = new String();
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(DateTimeConverter.class);
// RenderingContext key indicating the _dateFormat object
// has been created
private static final String _PATTERN_WRITTEN_KEY = "org.apache.myfaces.trinidadinternal.convert.DateTimeConverter._PATTERN_WRITTEN";
*Problem is if any input date componet is displaying other than current date then the date picker is always picking the current date rather existing date*
Please suggest me where to make changes?
Edited by: 858782 on Oct 3, 2011 7:43 AM
Edited by: 858782 on Oct 3, 2011 11:44 PMI need custom date foramts to be applied for different inputDates which are not defined in <af:convertDateTime>
Thanks
Edited by: 858782 on Oct 13, 2011 4:59 PM
Maybe you are looking for
-
Finding proper import settings
I have been having a problem with my audio not lining up with my video when I export a project. From reading some forum posts here it seems like it may be import settings causing the problem but I have no idea how to select the proper import setting
-
How to find db file scatered read in trace file?
Hi All, Was just going through basic concepts... 1. Created table T1with 1000 rows in LMT of 8k block size. 2. enabled tracing - alter session set events '10046 trace name context forever, level 12'; 3. performed - select * from T1; 4. ALTER SYSTEM S
-
Getting the date and time.
What is the best way to get the date and time? Thanks
-
Hi, its about rutines in BW
Hi friends, this is the scenario: i m filling an ODS but some InfoObjects i m getting them througt rutines by its tables, i wanna get CERTIF_YR and i have 0UCCONTRACT in my ODS my question is: when i try to connect fields trhought rutines they mus
-
How do I remove adblock if I haven't installed it?
TV player is blocking my access because I apparently have adblock installed. I haven't installed this and it shows up on safari extensions as an option to install. I've always had ads playing so it doesn't seem as if I have adblock! I can't contac