Calling a methos using groovy expression
Hi!!
I am using jdeveloper 11.1.1.5.,
I had created an transient attribute in my VO. I had also coded a method which returns some value in my AMImpl.
My Scneario :
I need to set the method's return value to my transient attribute.
Thank you!!
Now i had did little modification in my code only for StateDesc
public String getStateDesc(String dno)
if (dno == null)
return null;
else {
ViewObject vo = findViewObject("CityStateCountry1");
try {
Row[] row =
vo.findByKey(new Key(new Object[] { new Char(dno) }),
1);
if (row != null) {
Object name;
name = new Object();
for (int i=0;i<row.length;i++){
name = row.getAttribute("StateName1");
System.out.println (row.length);
if (name != null)
return name.toString();
else
return null;
return name.toString();
}else
return "Specified dept does not exists";
} catch (Exception e) {
e.printStackTrace();
return null;
While i am inserting new Record the StateDesc set the Value like thisjava.lang.Object@1d0740e
Similar Messages
-
Using groovy expressions to get a value of the current row
Hi,
I have a bounded task flow. The first step in the flow is calling an ExecuteWithParameters on one of my views. Based on the result of this query, I want to go to either Page1 or Page2.
So I have a router. I first tried to route based on whether or not the result of the query contained only one row. That worked fine. But I want to add a condition to that.
Basically, if the query returns one row AND that row has an attribute named 'Noc' == 1, then I want to go to Page2. Otherwise, go to Page 1.
Right now to get the estimatedRowCount I am getting the iterator from the pageDef file created for my ExecuteWithParams object. To see if 'Noc' == 1, I tried this:
#{data.rcl_view_reimbCode_search_results_task_flow_reimbCode_search_results_task_flow_ExecuteWithParamsPageDef.ReimbCodeSearchView1Iterator.currentRow.getAttribute("Noc") == 1}
But it is complaining of grammar issues.
What is the best way to go about getting the value of my attribute in a groovy expression?
Thanks,
JoelHi,
the best way is to use a managed bean reference
1. create a binding for the router
2. Expose the queried iterator in the PageDef file
3. write a managed bean that accesses the binding
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentEntry();
DCIteratorBinding iter = bindings.get("NameOfIterator");
// i) get estimated row count
// ii) get attribute value
//iii) evaluate
// iv) return true/false
Reference the managed bean from the router
Frank -
Calling dll-library using Oracle Express Language
I call my dll-library from Express Language 6.32, but it can't locate my library function.
How can I create a dll-library, suitable for Express.
btw, creating dll I used EXTCALL.c example and I have done all in such a way as in this example. -- but... :(
Please give me advice,
Thanks for listening.tbd wrote:
Hi rkpat,
You might check-out this thread on building WIN32 DLLs - expecially the bit re: "mangles names" under the paragraph titled "C Language Source File". My recollection is that 'extern "C"' directive in the header file for the DLL solved the name-mangling problem, but it's been a few years!
Cheers!
Message Edited by tbd on 03-01-2007 11:19 PM
tbd is right. You have to first disable name mangling as it creates all kind of troubles. Other issues might be that your Visual Studio 2003 or .Net edition links in dynamic runtime libraries that are not standard available on every Windows PC so that you need to redistribute the according runtime library installer together with your app for the DLL to be even loadable.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Using groovy expressions in error messages
Hi,
Suppose I have an error message with tokens. Eg: The value of {ATTRIBUTE1} must not be {VALUE1}.
We use source.hints.<AttributeName>.label to get the label of an attribute from the current EO. I need to way to access the attribute name of another VO. What is the syntax for this?Sure. I am using Jdev Studio Edition Version 11.1.1.6.0.
Suppose I have a parent EO called CarsEO. It has an attribute called CarModel.
I have a child for this called CarSparePartsEO. It has an attribute called CarSparePartType.
I have a validation for CarSparePartsEO.CarSparePartType and the error message should be something like this
The car model {ATTRIBUTE1} cannot have value {VALUE1} when {ATTRIBUTE2} is {VALUE2}.
ATTRIBUTE1 - CarModel's label
VALUE1 - CarModel's value
ATTRIBUTE2 - CarSparePartType's label
VALUE2 - CarSparePartType's value
How do I get the label and value of CarModel attribute? -
New paper published on using Groovy in JDeveloper 11g.
If you are looking to use Groovy expressions in ADF Business Components but finding the current developer guides less than helpful, I've pulled together some typical use cases into a new white paper
http://www.oracle.com/technology/products/jdev/11/how-tos/groovy/introduction_to_groovy.pdf
Please let me know if you have any corrections/questions/feedback/
Thanks
GrantThanks Grant for this paper.
I was wondering what could be the next level of integration of groovy besides ADF BC inside ADF apps.
As I have no real experience with Groovy at this time, would it be realistic to write groovy classes either in the model or the view/controller layer ?
The idea is to benefit from Groovy powerful aspects as a dynamic and very concise language. Such groovy classes would be used to extend ADF framework classes for example.
Does that makes sense to you and do you see any oppurtunities of such an integration ?
Thanks,
Seb. -
Groovy expression for error message in validation
hi...
using groovy expression i want to display a dynamic error message...(ie.i have a date field the date cant be a past date..if i enter the past date like (02-04-2012 )the error message should display with this date)For a validation rule on an entity attribute, you can use a Groovy expression to decide whether
an error or a warning message should be displayed using the following expression:
adf.error.raise("THIS_IS_AN_ERROR_MESSAGE")
adf.error.warn("THIS_IS_A_WARNING_MESSAGE")
In your case, you can customize the message and access the date attribute in the message as source.HireDate(Assuming HireDate is the date attribute)
Hope it helps. -
How can i call a bean methos using h:commandlink or h:commandButton?
Hi
i want to call a methos in the bean class throught h:commandbutton action
my code is
<h:commandLink action="#{sample.tryStuff1}" immediate="true" rendered="true">
<h:outputText value="add" />
</h:commandLink>
<h:commandButton id="ad"
action="#{sample.tryStuff1}"
immediate="true"
value="add"
type="SUBMIT"/>
what does immediat do here
i am trying both ways but its not calling the methosd.
what am i doing wrong?
my config file
<managed-bean>
<description>sample</description>
<managed-bean-name>sample</managed-bean-name>
<managed-bean-class>com.actsys.web.sample</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
please help
thansk in advancehave you tried the following?
<h:commandLink value="add" action="#{sample.tryStuff1}" />Also, it might be good to know if you are actually getting to the action method tryStruff1, what does sys.out show if you have it in the first line of the action method?
If you are getting to the action method, then there is probably an issue with your navigation handler. -
Accessing AppModuleImpl methods from Groovy expressions?
From a VO View Criteria bind variable I'm attempting to call an accessor (aka. getValue) in it's parent AppModuleImpl, via a Groovy expression. I thought I could do something like:
((model.AppModuleImpl)object.getApplicationModule()).getValue()
...but at runtime I'm getting an error that Groovy doesn't know model.AppModuleImpl.
I must be missing something here. Does anybody have the Groovy syntax for calling methods in the parent AppModuleImpl please? I've searched Grant Ronald's ADF Groovy whitepaper with no success, and I haven't found an example on these forums either.
With thanks,
CM.
PS. JDev 11.1.1.2.0, ADF BC + ADF Faces RCHi,
I am not sure but may be you found this post useful http://andrejusb.blogspot.com/2010/01/storingaccessing-objects-in-adf-bc.html
one more thing i did lately you can try if it works
I created Method in AppModuleImpl class and called it in VOImpl class with AM object and then assigned it as expression to the attribute value in VO it should work for Bind variable value as well
//Method in AM
public String sayHello(){
return "Hello World";
//Method in VOImpl
public String getHelloFromAM(){
AppModuleImpl am = new AppModuleImpl();
return am.sayHello();
//Attribute "HelloTEXT" default value
adf.object.getHelloFromAM()Hope it the same thing you are looking for
Baig
Edited by: BaiG on Jul 12, 2010 1:02 PM -
Error in groovy expression: Illegal type in constant pool
Hi,
I intermittently get this error on my page:
EMGC_OMS1 ERROR] [ http://oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator [tid:
userId: SYSMAN ecid: 004emUHK7jA9XbWLHyl3if0002JD0011gG,0:1 APP: emgc URI: ... ... ... :Server Exception during PPR, #15[[ javax.servlet.ServletException: java.lang.VerifyError: (class: org/codehaus/groovy/runtime/ArrayUtil, method: createArray signature: ()[Ljava/lang/Object;) Illegal type in constant pool
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
Caused by: java.lang.VerifyError: (class:
org/codehaus/groovy/runtime/ArrayUtil, method: createArray signature:
()[Ljava/lang/Object;) Illegal type in constant pool
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at bc4j.oracle_sysman_core_event_console_uimodel_view_IssueListVO_PriorityLocalizedLabel_null.gs.run(bc4j.oracle_sysman_core_event_console_uimodel_view_IssueListVO_PriorityLocalizedLabel_null.gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
The IssueListVO getPriorityLocalizedLabel uses a groovy expression:
oracle.sysman.core.event.common.uimodel.util.MetadataUtil.getPriorityLabel(Priority.intValue()).
The Priority field is defined to be numeric, and the repository data shows all records having a value of 0, so this groovy expression should behave correctly.
We are using Build JDEVADF_11.1.1.5.0_GENERIC_110409.0025.6013.
Any ideas on how to resolve this?
Thanks!cn u chk this
LinkageError -
ADF Groovy Expression with bind variable and ResourceBundle
Now I have ViewObject which have WHERE clause with bind variable.
This bind variable is for language. Within bind variable I can change Value Type to Expression and into Value: I put +(ResourceBundle.getBundle("model.ModelBundle")).getString("language")+.
Now if I run Oracle Business Component Browser (on AppModule) this works. In my ModelBundle.properties there is language=1 name-value pair. And with different locale I have different language number.
Now if I put that ViewObject on one JSF, this bind variable expression does not work any more. Error:
*oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.util.MissingResourceException, msg=Can't find bundle for base name model.ModelBundle, locale my_locale*
Any ideas?
10x
ZmedaThe most wierd thing is that, if I make ViewObjectImpl and insert this method
public String getLanguage() {
return (ResourceBundle.getBundle("model.ModelBundle")).getString("language");
and call it in Bind Variable Expression Value: viewObject.getLanguage()
IT WORKS!
But why with groovy expression it does not work?
Zmeda -
Session method and call transaction methos which one is the sap recomonded
hi
PLease give me the answer to these questions.
session method and call transaction methos which one is the sap recomonded why .
2) if we want to maintain BDC program in all the systems.wt to d0Hi Revethi,
Here is the difference between the Session and Call Transaction method.
Session
Session method supports both small amount of data aswell as large amount of data
2) data processing is asynchronus and data updation is synchronus.
3) it process multiple apllication while perfomaning validations.
4) in session method data will be updated in data base only after processing session only.
5) system provide by default logfile for handling error records.
6) it supports both foreground aswell as background process
in bdc we use FM ... bdc_open_group " for creating Session
bdc_insert " adding transaction and bdcdata table for updating database
bdc_close_group " for closing Session
Call Transaction
Call transaction exclusively for small amout of data
2) it supports only one apllication while perfoming validations
3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
we can create logfile by using structure....BDCMSGCOLL
4) it doesn't support background processing.
5) data processing is synchronous and Data updation is Synchronous( default), in
this method also supports daya updation in asynchronus process also.
Syntax:
Call transaction <transaction-name> using BDCDATA
mode <A/N/E> update <L/A/S>
messages into BDCMSGCOLL. -
How do I use airport express to extend my wireless network?
How vcan I extend the range of my wireless network using Airport Express?
It appears that you may have "join a wireless network" and "extend a wireless network" mixed up a bit.
The Express can "join" virtually any wireless network produced by any manufacturer's router if it is provided with the correct settings:
name of the wireless network
the correct wireless security settings
and correct password.
"Join" is normally used for AirTunes or to connect a USB printer to the Express for remote printing.
But, the Express does not provide any additional wirless coverage when it "joins" another wireless network.
Apple's "Extend a wireless network" feature, which was introduced about 5 years ago, allows the Express to connect to another Apple "n" wireless router and then "repeat" or "extend" the wireless signal....providing more wireless coverage in the area where the Express is located.
This is a proprietary setting. Apple says it will not work with devices from other manufacturers. To our knowledge, this is correct.
Prior to 2007, Apple used a setting called WDS to allow the Express to be configured to provide more wireless coverage. Attempts were made by a number of manufacturers to standardize the WDS settings, but things were never finalized.
The result is that Apple's older "b/g" routers were sometimes compatible with WDS settings from another manufacturer. There were a handful of products....5 or 6, as I recall....that were said to work. Some did, some didn't. Linksys had a couple of models, Netgear had one, SMC another, etc. Extremely limited.
Since WDS was never adopted as an industry standard, manufacturers developed their own WDS settings. Compatibility was extemely limited and unreliable. That continues to this day with WDS.
Bottom line....It is always best to stick with the same manufacturer throughout your network as far as routing is concerned.
If you have an newer "n" Apple router like an AirPort Extreme, the Express can extend the wireless as can along Extreme. If your Extreme is dual band, and you want to extend both bands, then you need another Extreme.
Another responder suggested to someone that they could connect the AirPort Express to a router via Ethernet. What exactly would that achieve?
That is a completely different subject since this discussion is about extending a wireless network using wireless only. -
How to access attribute value from another VO using groovy?
Hello, I am using JDeveloper 11.1.2.3.0
I read a lot of information about this but still I am missing something. I am trying to set the value of a bind variable through Groovy expression in my VO. I want this Bind variable
to have the value from an attribute from another VO. I tried ''adf.object.MyAppModuleImpl.findViewObject('Users1').currentRow.Iduser''
I am getting "oracle.jbo.expr.JISyntaxError: Variable MyAppModuleImpl not recognized". I tried with 'MyAppModule' only but the result is the same.
Can anyone help please?
ThanksCheck out http://www.oracle.com/technetwork/developer-tools/adf/learnmore/august2011-otn-harvest-457288.pdf Page 18 'Optimized Groovy data access to view objects'
Timo -
hi experts
am using jdev 11.1.1..5.0 - adfbc- oracledb10g
see here what i did,
GlAccountClassesVO - it' ah vo
GaclAcctType - it ' an attribute of this vo.
this vo has two primary key bu,id
GlLvlAccountsVO - it another vo
GlalGlasType - it ' an attribute of this vo.
this vo has 6 primary keys bu,lvl1,lvl2,lvl3,lvl4,acct and i have the asscoiation between two of the Eo's
GlAccountsClassesEO.GaclBu
GlLvlAccountsEo.GlalBuin this GlLvlAccountsVO go edit attribute in edit attibute wizard, choose value type as expersion
here i pasted this : adf.object.getGlalGlasType(GlAccountClasses.GaclAcctType)
make a test. it's say valid suntax no error raising
main thing is
i want to access the attribute of another vo .
while am running bc component browser.
shows some error.
and am going wrong. pls any one point me in right direction.
[168] SELECT GlLvlAccountsEO.GLAL_BU, GlLvlAccountsEO.GLAL_LVL1, GlLvlAccountsEO.GLAL_LVL2, GlLvlAccountsEO.GLAL_LVL3, GlLvlAccountsEO.GLAL_LVL4, GlLvlAccountsEO.GLAL_ACCT, GlLvlAccountsEO.GLAL_OPT_TYPE, GlLvlAccountsEO.GLAL_CRE_BY, GlLvlAccountsEO.GLAL_CRE_DATE, GlLvlAccountsEO.GLAL_UPD_BY, GlLvlAccountsEO.GLAL_UPD_DATE, GlLvlAccountsEO.GLAL_DESC1, GlLvlAccountsEO.GLAL_DESC2, GlLvlAccountsEO.GLAL_STATUS, GlLvlAccountsEO.GLAL_SENT_FLAG, GlLvlAccountsEO.GLAL_TITLE_ID, GlLvlAccountsEO.GLAL_FBT_PCT, GlLvlAccountsEO.GLAL_FBT_CAT, GlLvlAccountsEO.GLAL_BUD_FLAG, GlLvlAccountsEO.GLAL_PLANT, GlLvlAccountsEO.GLAL_CL_ID FROM GL_LVL_ACCOUNTS GlLvlAccountsEO
[169] ViewObject: [com.rits.glm.model.views.GlLvlAccountsVO]generalledgerAM.GlLvlAccounts1 Created new QUERY statement
[170] Bind params for ViewObject: [com.rits.glm.model.views.GlLvlAccountsVO]generalledgerAM.GlLvlAccounts1
[171] DBTransactionImpl.mDefaultSparseArrayThreshold is 20
[172] DCBindingContainer.reportException :oracle.jbo.expr.JIEvalException
[*173] oracle.jbo.expr.JIEvalException:
JBO-25077: Name GlAccountClasses not found in the given object:
ViewRow [oracle.jbo.Key[MEL MY1 MY2 MY3 MY4 0000000004 ]].*
at oracle.jbo.common.JboBeanUtils.getProperty(JboBeanUtils.java:85)
at oracle.jbo.common.JboBeanUtils.getPropertyInMapOrBean(JboBeanUtils.java:235)
at oracle.jbo.ExprEval.getRowVal(ExprEval.java:1375)
at oracle.jbo.server.RowImpl.getExprVarVal(RowImpl.java:1953)
at oracle.jbo.server.ViewRowImpl.getExprVarVal(ViewRowImpl.java:2895)
at oracle.jbo.ExprEval$ExprValueSupplierOverrideMap.internalGet(ExprEval.java:164)
at oracle.jbo.common.JboAbstractMap.get(JboAbstractMap.java:54)
at oracle.jbo.ExprEval$ExprEvalGroovyWrapper.getProperty(ExprEval.java:315)
at oracle.jbo.ExprEval$ExprValueSupplierGroovyBinding.getVariable(ExprEval.java:610)
at groovy.lang.Script.getProperty(Script.java:54)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
at bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.run(bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1261)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1083)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2141)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1835)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1897)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:840)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getGlalGlasType(GlLvlAccountsVORowImpl.java:984)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl$AttributesEnum$30.get(GlLvlAccountsVORowImpl.java:315)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getAttrInvokeAccessor(GlLvlAccountsVORowImpl.java:1083)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:870)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1157)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:751)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:779)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.updateValuesFromRow(JUCtrlAttrsBinding.java:145)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.refreshControl(JUCtrlAttrsBinding.java:245)
at oracle.jbo.jbotester.FieldFactory.createField(FieldFactory.java:230)
at oracle.jbo.jbotester.FieldFactory.createField(FieldFactory.java:153)
at oracle.jbo.jbotester.panel.BindingPanel.createField(BindingPanel.java:141)
at oracle.jbo.jbotester.panel.CardPanel.showAttributeDefs(CardPanel.java:210)
at oracle.jbo.jbotester.panel.CardPanel.showAttributeDefs(CardPanel.java:175)
at oracle.jbo.jbotester.panel.CardPanel.<init>(CardPanel.java:104)
at oracle.jbo.jbotester.panel.CardPanel.<init>(CardPanel.java:93)
at oracle.jbo.jbotester.panel.RowSetPanel.showCard(RowSetPanel.java:234)
at oracle.jbo.jbotester.panel.RowSetPanel.setIterator(RowSetPanel.java:105)
at oracle.jbo.jbotester.panel.BindingPanel.setBindingContext(BindingPanel.java:118)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:88)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:71)
at oracle.jbo.jbotester.form.BindingForm.createMasterPanel(BindingForm.java:63)
at oracle.jbo.jbotester.form.BindingForm.init(BindingForm.java:98)
at oracle.jbo.jbotester.form.JTForm.<init>(JTForm.java:72)
at oracle.jbo.jbotester.form.BindingForm.<init>(BindingForm.java:50)
at oracle.jbo.jbotester.form.FormType$1.createForm(FormType.java:63)
at oracle.jbo.jbotester.form.FormType.createForm(FormType.java:199)
at oracle.jbo.jbotester.form.FormType.createTab(FormType.java:270)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:248)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:207)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:203)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:140)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:123)
at oracle.jbo.jbotester.tree.Tree.processTreeMouseClicked(Tree.java:728)
at oracle.jbo.jbotester.tree.Tree.access$100(Tree.java:96)
at oracle.jbo.jbotester.tree.Tree$TreeMouseListener.mouseClicked(Tree.java:141)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6292)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[174] JUErrorHandlerDlg.reportException(oracle.jbo.expr.JIEvalException)
[175] DCBindingContainer.reportException :oracle.jbo.expr.JIEvalException
*[176] oracle.jbo.expr.JIEvalException: JBO-25077: Name GlAccountClasses not found in the given object: ViewRow [oracle.jbo.Key[MEL MY1 MY2 MY3 MY4 0000000004 ]].*
at oracle.jbo.common.JboBeanUtils.getProperty(JboBeanUtils.java:85)
at oracle.jbo.common.JboBeanUtils.getPropertyInMapOrBean(JboBeanUtils.java:235)
at oracle.jbo.ExprEval.getRowVal(ExprEval.java:1375)
at oracle.jbo.server.RowImpl.getExprVarVal(RowImpl.java:1953)
at oracle.jbo.server.ViewRowImpl.getExprVarVal(ViewRowImpl.java:2895)
at oracle.jbo.ExprEval$ExprValueSupplierOverrideMap.internalGet(ExprEval.java:164)
at oracle.jbo.common.JboAbstractMap.get(JboAbstractMap.java:54)
at oracle.jbo.ExprEval$ExprEvalGroovyWrapper.getProperty(ExprEval.java:315)
at oracle.jbo.ExprEval$ExprValueSupplierGroovyBinding.getVariable(ExprEval.java:610)
at groovy.lang.Script.getProperty(Script.java:54)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
at bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.run(bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1261)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1083)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2141)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1835)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1897)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:840)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getGlalGlasType(GlLvlAccountsVORowImpl.java:984)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl$AttributesEnum$30.get(GlLvlAccountsVORowImpl.java:315)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getAttrInvokeAccessor(GlLvlAccountsVORowImpl.java:1083)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:870)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1157)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:751)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:779)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.updateValuesFromRow(JUCtrlAttrsBinding.java:145)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.refreshControl(JUCtrlAttrsBinding.java:245)
at oracle.jbo.jbotester.BindingAdapter.refresh(BindingAdapter.java:69)
at oracle.jbo.jbotester.panel.CardPanel.refreshAll(CardPanel.java:128)
at oracle.jbo.jbotester.panel.RowSetPanel.refreshAll(RowSetPanel.java:206)
at oracle.jbo.jbotester.panel.RowSetPanel.showCard(RowSetPanel.java:236)
at oracle.jbo.jbotester.panel.RowSetPanel.setIterator(RowSetPanel.java:105)
at oracle.jbo.jbotester.panel.BindingPanel.setBindingContext(BindingPanel.java:118)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:88)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:71)
at oracle.jbo.jbotester.form.BindingForm.createMasterPanel(BindingForm.java:63)
at oracle.jbo.jbotester.form.BindingForm.init(BindingForm.java:98)
at oracle.jbo.jbotester.form.JTForm.<init>(JTForm.java:72)
at oracle.jbo.jbotester.form.BindingForm.<init>(BindingForm.java:50)
at oracle.jbo.jbotester.form.FormType$1.createForm(FormType.java:63)
at oracle.jbo.jbotester.form.FormType.createForm(FormType.java:199)
at oracle.jbo.jbotester.form.FormType.createTab(FormType.java:270)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:248)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:207)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:203)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:140)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:123)
at oracle.jbo.jbotester.tree.Tree.processTreeMouseClicked(Tree.java:728)
at oracle.jbo.jbotester.tree.Tree.access$100(Tree.java:96)
at oracle.jbo.jbotester.tree.Tree$TreeMouseListener.mouseClicked(Tree.java:141)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6292)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[177] JUErrorHandlerDlg.reportException(oracle.jbo.expr.JIEvalException)
[178] **** refreshControl() for BindingContainer :generalledgerAM_GlLvlAccounts1_0PageDef
[179] *** DCDataControl.sync() called from :DCBindingContainer.refresh
*[180] DCBindingContainer.reportException :oracle.jbo.expr.JIEvalException*
*[181] oracle.jbo.expr.JIEvalException: JBO-25077: Name GlAccountClasses not found in the given object: ViewRow [oracle.jbo.Key[MEL MY1 MY2 MY3 MY4 0000000004 ]].*
at oracle.jbo.common.JboBeanUtils.getProperty(JboBeanUtils.java:85)
at oracle.jbo.common.JboBeanUtils.getPropertyInMapOrBean(JboBeanUtils.java:235)
at oracle.jbo.ExprEval.getRowVal(ExprEval.java:1375)
at oracle.jbo.server.RowImpl.getExprVarVal(RowImpl.java:1953)
at oracle.jbo.server.ViewRowImpl.getExprVarVal(ViewRowImpl.java:2895)
at oracle.jbo.ExprEval$ExprValueSupplierOverrideMap.internalGet(ExprEval.java:164)
at oracle.jbo.common.JboAbstractMap.get(JboAbstractMap.java:54)
at oracle.jbo.ExprEval$ExprEvalGroovyWrapper.getProperty(ExprEval.java:315)
at oracle.jbo.ExprEval$ExprValueSupplierGroovyBinding.getVariable(ExprEval.java:610)
at groovy.lang.Script.getProperty(Script.java:54)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
at bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.run(bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1261)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1083)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2141)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1835)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1897)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:840)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getGlalGlasType(GlLvlAccountsVORowImpl.java:984)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl$AttributesEnum$30.get(GlLvlAccountsVORowImpl.java:315)
at com.rits.glm.model.views.GlLvlAccountsVORowImpl.getAttrInvokeAccessor(GlLvlAccountsVORowImpl.java:1083)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:870)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1157)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:751)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:779)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.updateValuesFromRow(JUCtrlAttrsBinding.java:145)
at oracle.jbo.uicli.binding.JUIteratorBinding.updateValuesFromRows(JUIteratorBinding.java:338)
at oracle.adf.model.binding.DCIteratorBinding.setupRSIstate(DCIteratorBinding.java:838)
at oracle.adf.model.binding.DCIteratorBinding.refreshControl(DCIteratorBinding.java:679)
at oracle.jbo.uicli.binding.JUIteratorBinding.refreshControl(JUIteratorBinding.java:474)
at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4437)
at oracle.adf.model.binding.DCBindingContainer.refreshExecutables(DCBindingContainer.java:3507)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3340)
at oracle.adf.model.binding.DCBindingContainer.refreshControl(DCBindingContainer.java:2906)
at oracle.jbo.jbotester.panel.BindingPanel.setBindingContext(BindingPanel.java:120)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:88)
at oracle.jbo.jbotester.panel.BindingPanel.<init>(BindingPanel.java:71)
at oracle.jbo.jbotester.form.BindingForm.createMasterPanel(BindingForm.java:63)
at oracle.jbo.jbotester.form.BindingForm.init(BindingForm.java:98)
at oracle.jbo.jbotester.form.JTForm.<init>(JTForm.java:72)
at oracle.jbo.jbotester.form.BindingForm.<init>(BindingForm.java:50)
at oracle.jbo.jbotester.form.FormType$1.createForm(FormType.java:63)
at oracle.jbo.jbotester.form.FormType.createForm(FormType.java:199)
at oracle.jbo.jbotester.form.FormType.createTab(FormType.java:270)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:248)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:207)
at oracle.jbo.jbotester.form.FormType.showForm(FormType.java:203)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:140)
at oracle.jbo.jbotester.tree.ObjTreeNode.showForm(ObjTreeNode.java:123)
at oracle.jbo.jbotester.tree.Tree.processTreeMouseClicked(Tree.java:728)
at oracle.jbo.jbotester.tree.Tree.access$100(Tree.java:96)
at oracle.jbo.jbotester.tree.Tree$TreeMouseListener.mouseClicked(Tree.java:141)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6292)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
*[182] JUErrorHandlerDlg.reportException(oracle.jbo.expr.JIEvalException)*
*[183] DCBindingContainer.reportException :oracle.jbo.expr.JIEvalException*
*[184] oracle.jbo.expr.JIEvalException: JBO-25077: Name GlAccountClasses not found in the given object: ViewRow [oracle.jbo.Key[MEL MY1 MY2 MY3 MY4 0000000004 ]].*
at oracle.jbo.common.JboBeanUtils.getProperty(JboBeanUtils.java:85)
at oracle.jbo.common.JboBeanUtils.getPropertyInMapOrBean(JboBeanUtils.java:235)
at oracle.jbo.ExprEval.getRowVal(ExprEval.java:1375)
at oracle.jbo.server.RowImpl.getExprVarVal(RowImpl.java:1953)
at oracle.jbo.server.ViewRowImpl.getExprVarVal(ViewRowImpl.java:2895)
at oracle.jbo.ExprEval$ExprValueSupplierOverrideMap.internalGet(ExprEval.java:164)
at oracle.jbo.common.JboAbstractMap.get(JboAbstractMap.java:54)
at oracle.jbo.ExprEval$ExprEvalGroovyWrapper.getProperty(ExprEval.java:315)
at oracle.jbo.ExprEval$ExprValueSupplierGroovyBinding.getVariable(ExprEval.java:610)
at groovy.lang.Script.getProperty(Script.java:54)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
at bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.run(bc4j.com_rits_glm_model_views_GlLvlAccountsVO_GlalGlasType_null.gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1261)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1083)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2141)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1835)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1897)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:840)Hi,
is this a static class with an inner class you created: GlAccountClasses.GaclAcctType ? If not then this cannot be found. If you want to pass the reference to another View Object, use
a) a method exposed on the other VO Impl class
b) The ViewLink accessor
If you are using Groovy on a VO level then it doesn't help if you have accessors defined on the EO level
This may help too: http://blogs.oracle.com/raghuyadav/entry/groovy_samples
Frank -
Trying to use regular expressions to convert names to Title Case
I'm trying to change names to their proper case for most common names in North America (esp. the U.S.).
Some examples are in the comments of the included code below.
My problem is that *retName = retName.replaceAll("( [^ ])([^ ]+)", "$1".toUpperCase() + "$2");* does not work as I expect. It seems that the toUpperCase method call does not actually do anything to the identified group.
Everything else works as I expect.
I'm hoping that I do not have to iterate through each character of the string, upshifting the characters that follow spaces.
Any help from you RegEx experts will be appreciated.
{code}
* Converts names in some random case into proper Name Case. This method does not have the
* extra processing that would be necessary to convert street addresses.
* This method does not add or remove punctuation.
* Examples:
* DAN MARINO --> Dan Marino
* old macdonald --> Old Macdonald <-- Can't capitalize the 'D" because of Ernst Mach
* ROY BLOUNT, JR. --> Roy Blount, Jr.
* CAROL mosely-BrAuN --> Carol Mosely-Braun
* Tom Jones --> Tom Jones
* ST.LOUIS --> St. Louis
* ST.LOUIS, MO --> St. Louis, Mo <-- Avoid City Names plus State Codes
* This is a work in progress that will need to be updated as new exceptions are found.
public static String toNameCase(String name) {
* Basic plan:
* 1. Strategically create double spaces in front of characters to be capitalized
* 2. Capitalize characters with preceding spaces
* 3. Remove double spaces.
// Make the string all lower case
String retName = name.trim().toLowerCase();
// Collapse strings of spaces to single spaces
retName = retName.replaceAll("[ ]+", " ");
// "mc" names
retName = retName.replaceAll("( mc)", " $1");
// Ensure there is one space after periods and commas
retName = retName.replaceAll("(\\.|,)([^ ])", "$1 $2");
// Add 2 spaces after periods, commas, hyphens and apostrophes
retName = retName.replaceAll("(\\.|,|-|')", "$1 ");
// Add a double space to the front of the string
retName = " " + retName;
// Upshift each character that is preceded by a space
// For some reason this doesn't work
retName = retName.replaceAll("( [^ ])([^ ]+)", "$1".toUpperCase() + "$2");
// Remove double spaces
retName = retName.replaceAll(" ", "");
return retName;
Edited by: FuzzyBunnyFeet on Jan 17, 2011 10:56 AM
Edited by: FuzzyBunnyFeet on Jan 17, 2011 10:57 AMHopefully someone will still be able to provide a RegEx solution, but until that time here is a working method.
Also, if people have suggestions of other rules for letter capitalization in names, I am interested in those too.
* Converts names in some random case into proper Name Case. This method does not have the
* extra processing that would be necessary to convert street addresses.
* This method does not add or remove punctuation.
* Examples:
* CAROL mosely-BrAuN --> Carol Mosely-Braun
* carol o'connor --> Carol O'Connor
* DAN MARINO --> Dan Marino
* eD mCmAHON --> Ed McMahon
* joe amcode --> Joe Amcode <-- Embedded "mc"
* mr.t --> Mr. T <-- Inserted space
* OLD MACDONALD --> Old Macdonald <-- Can't capitalize the 'D" because of Ernst Mach
* old mac donald --> Old Mac Donald
* ROY BLOUNT,JR. --> Roy Blount, Jr.
* ST.LOUIS --> St. Louis
* ST.LOUIS,MO --> St. Louis, Mo <-- Avoid City Names plus State Codes
* Tom Jones --> Tom Jones
* This is a work in progress that will need to be updated as new exceptions are found.
public static String toNameCase(String name) {
* Basic plan:
* 1. Strategically create double spaces in front of characters to be capitalized
* 2. Capitalize characters with preceding spaces
* 3. Remove double spaces.
// Make the string all lower case
String workStr = name.trim().toLowerCase();
// Collapse strings of spaces to single spaces
workStr = workStr.replaceAll("[ ]+", " ");
// "mc" names
workStr = workStr.replaceAll("( mc)", " $1 ");
// Ensure there is one space after periods and commas
workStr = workStr.replaceAll("(\\.|,)([^ ])", "$1 $2");
// Add 2 spaces after periods, commas, hyphens and apostrophes
workStr = workStr.replaceAll("(\\.|,|-|')", "$1 ");
// Add a double space to the front of the string
workStr = " " + workStr;
// Upshift each character that is preceded by a space and remove double spaces
// Can't upshift using regular expressions and String methods
// workStr = workStr.replaceAll("( [^ ])([^ ]+)", "$1"toUpperCase() + "$2");
StringBuilder titleCase = new StringBuilder();
for (int i = 0; i < workStr.length(); i++) {
if (workStr.charAt(i) == ' ') {
if (workStr.charAt(i+1) == ' ') {
i += 2;
while (i < workStr.length() && workStr.charAt(i) == ' ') {
titleCase.append(workStr.charAt(i++));
if (i < workStr.length()) {
titleCase.append(workStr.substring(i, i+1).toUpperCase());
} else {
titleCase.append(workStr.charAt(i));
return titleCase.toString();
{code}
Maybe you are looking for
-
Searches don't work as PUBLIC user (i.e. not logged on)
Hello world, We're using Portal 3.0.9.8.1 with Patch 1949492 installed. This is on 8.1.7.2.4 SE Database. When performing searches as the PUBLIC user (i.e. not logged on) we only get limited returns (often zero) where there should be 100s. Documents
-
The bar at the top of the page does not display the webpage address anymore after I changed some setting while trying to delete a bookmark. It appears I've permanently deleted web addresses. How do I restore this setting?
-
What is the best export option in iMovie for intro media in iBooks Author?
-
Intel(R) Embedded Server RAID Technology II and Oracle VM Server
Hi There This is a head's up for anyone installing on a beast with the above mentioned on-board raid controller. You have to use the Intel Setup CD to configure the raid. When you use the raid's bios to setup raid, the bios assign a name to the raid
-
Hi All, Could you please give me any suggestion how I config first consolidation for consolidation unit that use equity method because after run COI task (in UCMON), system record Goodwill account and decrease investment account (amount same that we