[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Messages posted by: cvieira  XML
Profile for cvieira -> Messages posted by cvieira [59] Go to Page: Previous  1, 2, 3, 4 Next 
Author Message
Hi Bjorn,

I thought that it was possible to do it in someway... but Ok, i will change my ADAPTERBINDING class to accomodate my requirement, without "looking" into JSP parameters.

Many thanks for your time!

Regards,
Hi Bjorn, thanks! Well, you're very welcome to visit Portugal

Taking your example:

Code:
  <t:rowbodypane id="g_3">
  	<t:row id="g_4">
  		<t:field id="g_5" adapterbinding="#{wp.Test47.fields.firstName}"
  			regex="[01]{5}" width="100" />
  	</t:row>
  	<t:row id="g_6">
  		<t:field id="g_7" adapterbinding="#{wp.Test47.fields.lastName}"
  			width="100" />
  	</t:row>
  </t:rowbodypane>
 


What i want is to get in code, the firstName regex pattern that was defined in layout. And i can't get that value... maybe there is some misunderstanding here...

My intention is to get regex pattern (from layout... in your example is "[01]{5}" for first name) so i can validate it on server side and do some action (show errors, etc...), or avoid submit action, etc...

Thanks,
Hi Bjorn,

In fact that does not solve the issue... even removing it from FIELDDYNATTRIBUTES did not work. I've tried with other attributes, such as regexhint and others with no success also...

Any chance to be a CC bug?

Regards,
Hi Bjor, well i'm not sure

I can't figure it out why regex value is null, when i have regex defined on the rich editor (jsp). It maybe my fault somehwere in the code, but i can't see any error... and you look at it also and it look like it was ok right?

Any further ideas?

Thanks,
Hi Bjorn, thanks for your quick reply!

Well, i've made the test, and it seems that the value is always null... i can't get the regex string pattern that is defined on the fields

Thanks!
Hi, i'm using adapter binding on my forms, and i'm trying to use regex defined on fields to be also validated on the WorkpageDispatchedBean, llike it happens with mandatory fields, etc...

My base class is based on the adapter binding form example on the demo application. All the code is working Ok, except for the regex thing... i define regex expression on the necessary fields, and then i try to get that value to make the validation... but the value is always null... it's missing something on the code, but can't figure it out... can anyone help? Here's the code:

Code:
 public class DefaultFormAdapterBinding extends WorkpageDispatchedBean implements Serializable {
 
     static final Logger logger = Logger.getLogger(DefaultFormAdapterBinding.class.getName());
     // ------------------------------------------------------------------------
     // inner classes
     // ------------------------------------------------------------------------
     static Set<String> FIELDFIXATTRIBUTES = new HashSet<String>();
     static Set<String> FIELDDYNATTRIBUTES = new HashSet<String>();
 
     static {
         FIELDDYNATTRIBUTES.add("text");
         FIELDDYNATTRIBUTES.add("bgpaint");
         FIELDDYNATTRIBUTES.add("enabled");
         FIELDDYNATTRIBUTES.add("requestfocus");
         FIELDDYNATTRIBUTES.add("regex");
     }
 
     /**
      * Adapter binding that is behind one form field.
      */
     public class FIELDAdapterBinding implements IComponentAdapterBinding {
 
         public String m_text;
         public String m_propertyName;
         public boolean m_enabled = true;
         long m_requestfocus = -1;
         public boolean m_hasError = false;
         public boolean m_isMandatory = false;
         public String m_regex;
 
         public FIELDAdapterBinding(boolean isMandatory, String propertyName) {
             m_isMandatory = isMandatory;
             m_propertyName = propertyName;
         }
 
         @Override
         public Class getAttibuteType(String attributeName) {
             return String.class;
         }
 
         @Override
         public Object getAttributeValue(String attributeName) {
             if ("text".equals(attributeName)) {
                 return m_text;
             }
             if ("bgpaint".equals(attributeName)) {
                 return getBgpaint();
             }
             if ("enabled".equals(attributeName)) {
                 return m_enabled;
             }
             if ("requestfocus".equals(attributeName)) {
                 return m_requestfocus;
             }
             if ("regex".equals(attributeName)) {
                 return m_regex;
             }
             throw new Error("Should never happen!");
         }
 
         @Override
         public Set<String> getDynamicAttributeNames() {
             return FIELDDYNATTRIBUTES;
         }
 
         @Override
         public Set<String> getFixAttributeNames() {
             return FIELDFIXATTRIBUTES;
         }
 
         @Override
         public void onAction(ActionEvent event) {
             if (event instanceof BaseActionEventValueHelp) {
                 openValidValueHelp(this);
             }
         }
 
         @Override
         public void setAttributeValue(String attributeName, Object value) {
             if ("text".equals(attributeName)) {
                 m_text = (String) value;
             }
         }
 
         private String getBgpaint() {
             if (m_hasError == true) {
                 return "error()";
             }
             if (m_isMandatory == true) {
                 return "mandatory()";
             }
             return null;
         }
     }
     // ------------------------------------------------------------------------
     // members
     // ------------------------------------------------------------------------
     Map<String, FIELDAdapterBinding> m_fields = new HashMap<String, FIELDAdapterBinding>();
 
     // ------------------------------------------------------------------------
     // constructors
     // ------------------------------------------------------------------------
     public DefaultFormAdapterBinding(IWorkpageDispatcher dispatcher) {
         super(dispatcher);
     }
 
     // ------------------------------------------------------------------------
     // public usage
     // ------------------------------------------------------------------------
     public Map<String, FIELDAdapterBinding> getFields() {
         return m_fields;
     }
 
     // ------------------------------------------------------------------------
     // private usage
     // ------------------------------------------------------------------------
     public void registerField(String propertyName, boolean isMandatory) {
         m_fields.put(propertyName, new FIELDAdapterBinding(isMandatory, propertyName));
     }
 
     public boolean isGenericFieldValidationError(Dispatcher dispatcher) {
         boolean foundError = false;
         
         // reset error information
         for (FIELDAdapterBinding field : getFields().values()) {
             field.m_hasError = false;
         }
                
         // check for mandatory and regex
         for (FIELDAdapterBinding field : getFields().values()) {
             if (field.m_isMandatory == true && (field.m_text == null || field.m_text.length() == 0) ) {
                 foundError = true;
                 dispatcher.getStatusbar().writeAlert("Mandatory input field " + field.m_propertyName + " is missing");
             }
             
             logger.log(Level.INFO, "Field {0} regex pattern is {1}", new Object[]{field.m_propertyName, field.m_regex});
             
             if (field.m_regex != null && field.m_regex.length() > 0){
                 logger.log(Level.INFO, "Field {0} regex pattern is {1}", new Object[]{field.m_propertyName, field.m_regex});
                 Pattern p = Pattern.compile(field.m_regex, Pattern.CASE_INSENSITIVE);
                 Matcher m = p.matcher(field.m_text);
                 if (!m.matches()){
                     foundError = true;
                     dispatcher.getStatusbar().writeAlert("Field " + field.m_propertyName + " has not a valid value");
                 }
             }
         }
         
         return foundError;
     }
 
     public void openValidValueHelp(final FIELDAdapterBinding field) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 }
 
Hi Markus,

Your solution is pretty clever works fine and it's the solution for the most user purposes on this scope.

Many thanks for your valuable help!

Regards,
Carlos
Hi, thanks for sharing!

I successfully implemented the login action, maintaining relevant session information, but i'm having a problem with the redirect to logon page, when there is no user logged in... i have a surrounding page, and after login i change the content of surrounding page to a page "test.jsp", for example. Works fine... but if a user enters directly in "test.jsp" page, i want to redirect user to logon page again... but i'm not getting the way to redirect to logon page...

How can we do a simple redirect to a specific page? Eventually this is something basic in CC, but i'm can not find a way to do so... any help would be appreciated...

Thanks,
Hi Bjorn, it seems to exist an issue here, because ii have status marked as mandatory on the order entity... when trying to save it allows it.
Regards,
Hi, i wonder if anyone can help me regarding the use of entity functions:
* how can we make it work
* how can we manage functions on UI, if we have a lot of functions (how do they appear in this case?)
* functions can be accessed on entity detail and on entity grid as well?

Well, what i need is a basic explanation of the use of functions on SDM, and how to make use of it's power... also, for user defined functions, we can also define access per role, righ, as we do with fields?

Thank you,
Hi Bjorn, thanks!

Well, you right... i can use without problems on those entities marked with status-management... maybe for the ones that are not, exception could be treated avoiding error to appear...

Two questions related to status (using your orders example):
* i've defined a status as being initial status, but i was allowed to save an order without a status defined (the status field is marked as mandatory also)
* order status is defined by clicking on status appearing on the form toolbar... is the only way to do it? Or when can define by using a combobox within form field?

Regards,
Carlos V.
Sorry Bjorn, here is file content (ccappor.metadata.xml):

Code:
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <mdApplication>
     <id>ccsdmfirst</id>
     <dispatcherId>d</dispatcherId>
     <text>Structured Data Manager Application</text>
     <packages>
         <id>first.data</id>
     </packages>
     <packages>
         <id>first.ui</id>
     </packages>
     <packages>
         <id>first.logic</id>
     </packages>
     <entities>
         <id>customer</id>
         <package>first.data</package>
         <daoPackage>first.data</daoPackage>
         <logicPackage>first.logic</logicPackage>
         <uiPackage>first.ui</uiPackage>
         <text>Customer</text>
         <multiClient>false</multiClient>
         <withLiteralManagement>false</withLiteralManagement>
         <withOneLanguageOnly>false</withOneLanguageOnly>
         <withImageManagement>false</withImageManagement>
         <withStatusManagement>false</withStatusManagement>
         <properties>
             <id>customerId</id>
             <key>true</key>
             <text>Customer Id</text>
             <dataType>guid</dataType>
             <length>0</length>
             <linkedWithinOwnObject>false</linkedWithinOwnObject>
             <status>false</status>
             <mandatory>false</mandatory>
             <flush>false</flush>
             <hide>false</hide>
             <logicBeanProperty>false</logicBeanProperty>
             <virtualTextProperty>false</virtualTextProperty>
         </properties>
         <properties>
             <id>name</id>
             <key>false</key>
             <text>Name</text>
             <dataType>String</dataType>
             <length>200</length>
             <linkedWithinOwnObject>false</linkedWithinOwnObject>
             <status>false</status>
             <mandatory>false</mandatory>
             <flush>false</flush>
             <hide>false</hide>
             <logicBeanProperty>false</logicBeanProperty>
             <virtualTextProperty>false</virtualTextProperty>
         </properties>
         <functions>
             <id>sendEmail</id>
             <text>Send Email</text>
             <hide>false</hide>
         </functions>
     </entities>
     <includedApplications>eclntccapporbaseapps</includedApplications>
 </mdApplication>
 


Thanks,
Hi,

I'm having problems when using two configuration functions: status definitions -> transitions; input status -> by status

(1) status definitions -> transitions
Code:
 javax.servlet.ServletException: java.lang.Error: org.eclnt.ccappor.util.WrapperError: java.lang.NullPointerException
 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.jsfserver.util.ThreadingFilter.doFilter(ThreadingFilter.java:269)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.ccappor.rt.context.ThreadContextFilter.doFilter(ThreadContextFilter.java:69)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [...]
 


(2) input status -> by status
Code:
 javax.servlet.ServletException: java.lang.Error: java.lang.NullPointerException
 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.jsfserver.util.ThreadingFilter.doFilter(ThreadingFilter.java:269)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.ccappor.rt.context.ThreadContextFilter.doFilter(ThreadContextFilter.java:69)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.jsfserver.util.CompressionFilter.doFilter(CompressionFilter.java:33)
 [...]
 


Any ideas of what's wrong?

Thanks & Regards,
Hi Bjorn,

Here is the file contents:

Code:
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <mdApplication>
     <id>ccsdmfirst</id>
     <dispatcherId>d</dispatcherId>
     <text>Structured Data Manager Application</text>
     <packages>
         <id>first.data</id>
     </packages>
     <packages>
         <id>first.ui</id>
     </packages>
     <packages>
         <id>first.logic</id>
     </packages>
     <entities>
         <id>customer</id>
         <package>first.data</package>
         <daoPackage>first.data</daoPackage>
         <logicPackage>first.logic</logicPackage>
         <uiPackage>first.ui</uiPackage>
         <text>Customer</text>
         <multiClient>true</multiClient>
         <withLiteralManagement>true</withLiteralManagement>
         <withOneLanguageOnly>false</withOneLanguageOnly>
         <withImageManagement>false</withImageManagement>
         <withStatusManagement>false</withStatusManagement>
         <properties>
             <id>customerId</id>
             <key>true</key>
             <text>Customer Id</text>
             <dataType>guid</dataType>
             <length>0</length>
             <linkedWithinOwnObject>false</linkedWithinOwnObject>
             <status>false</status>
             <mandatory>true</mandatory>
             <flush>false</flush>
             <hide>false</hide>
             <logicBeanProperty>false</logicBeanProperty>
             <virtualTextProperty>false</virtualTextProperty>
         </properties>
         <properties>
             <id>name</id>
             <key>false</key>
             <text>Name</text>
             <dataType>String</dataType>
             <length>200</length>
             <linkedWithinOwnObject>false</linkedWithinOwnObject>
             <status>false</status>
             <mandatory>false</mandatory>
             <flush>false</flush>
             <hide>false</hide>
             <logicBeanProperty>false</logicBeanProperty>
             <virtualTextProperty>false</virtualTextProperty>
         </properties>
         <functions>
             <id>delete</id>
             <text>Delete</text>
             <type>delete</type>
             <hide>false</hide>
         </functions>
     </entities>
     <includedApplications>eclntccapporbaseapps</includedApplications>
 </mdApplication>
 


I also noticed the following exception when clicking on Configuration->Input Status->By Status

Code:
 javax.servlet.ServletException: java.lang.Error: java.lang.NullPointerException
 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.jsfserver.util.ThreadingFilter.doFilter(ThreadingFilter.java:269)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.ccappor.rt.context.ThreadContextFilter.doFilter(ThreadContextFilter.java:69)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 	at org.eclnt.jsfserver.util.CompressionFilter.doFilter(CompressionFilter.java:33)
 


Regards,
Hi Bjorn, Many Thanks!

Let me know just this please, if you don't mind:
* current release of SDM is still BETA software? If yes, there is any milestone for the stable release?
* Is there any complete working example, showing the capabilities of SDM?

Also, when running SDM, and make a simple example project with a couple of entities, i always get an exception when trying to use one of the created entities, after login. The other existing entities like attachments, etc... are Ok....

Just posting part of the exception:

Code:
 Server side:
 
 javax.servlet.ServletException: Index: 0, Size: 0
 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [...]
 Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
 	at java.util.ArrayList.RangeCheck(Unknown Source)
 	at java.util.ArrayList.get(Unknown Source)
 	at org.eclnt.jsfserver.elements.impl.FIXGRIDComponent.checkIfColumnIsRendered(FIXGRIDComponent.java:2134)
 	at org.eclnt.jsfserver.elements.impl.FIXGRIDComponent.encodeChildren(FIXGRIDComponent.java:741)
 [...]
 
 Client side
 
 java.io.IOException
 java.io.IOException: Server returned HTTP response code: 500 for URL: <a href="http://localhost:50000/ccsdmfirst/faces/ccapporpages/start.jsp;jsessionid=EC94A538823BE3A28AABB000354EC3DB" target="_blank" rel="nofollow">http://localhost:50000/ccsdmfirst/faces/ccapporpages/start.jsp;jsessionid=EC94A538823BE3A28AABB000354EC3DB</a>
 


Best Regards,
 
Profile for cvieira -> Messages posted by cvieira [59] Go to Page: Previous  1, 2, 3, 4 Next 
Go to:   
Powered by JForum 2.1.6 © JForum Team