List of usage examples for java.lang InstantiationException getMessage
public String getMessage()
From source file:com.google.code.simplestuff.bean.SimpleBean.java
/** * /* w w w . j a v a 2 s. c o m*/ * Returns a test object with all the {@link BusinessField} annotated fields * set to a test value. TODO At the moment only the String field are * considered and the collection are not considered. * * @param bean The class of the bean to fill. * @param suffix The suffix to append in the string field. * @return The bean with test values. */ public static <T> T getTestBean(Class<T> beanClass, String suffix) { if (beanClass == null) { throw new IllegalArgumentException("The bean class passed is null!!!"); } T testBean = null; try { testBean = beanClass.newInstance(); } catch (InstantiationException e1) { if (log.isDebugEnabled()) { log.debug(e1.getMessage()); } } catch (IllegalAccessException e1) { if (log.isDebugEnabled()) { log.debug(e1.getMessage()); } } BusinessObjectDescriptor businessObjectInfo = BusinessObjectContext.getBusinessObjectDescriptor(beanClass); // We don't need here a not null check since by contract the // getBusinessObjectDescriptor method always returns an abject. if (businessObjectInfo.getNearestBusinessObjectClass() != null) { Collection<Field> annotatedField = businessObjectInfo.getAnnotatedFields(); for (Field field : annotatedField) { final BusinessField fieldAnnotation = field.getAnnotation(BusinessField.class); if (fieldAnnotation != null) { try { if (field.getType().equals(String.class)) { String stringValue = "test" + StringUtils.capitalize(field.getName()) + (suffix == null ? "" : suffix); PropertyUtils.setProperty(testBean, field.getName(), stringValue); } else if ((field.getType().equals(boolean.class)) || (field.getType().equals(Boolean.class))) { PropertyUtils.setProperty(testBean, field.getName(), true); } else if ((field.getType().equals(int.class)) || (field.getType().equals(Integer.class))) { PropertyUtils.setProperty(testBean, field.getName(), 10); } else if ((field.getType().equals(char.class)) || (field.getType().equals(Character.class))) { PropertyUtils.setProperty(testBean, field.getName(), 't'); } else if ((field.getType().equals(long.class)) || (field.getType().equals(Long.class))) { PropertyUtils.setProperty(testBean, field.getName(), 10L); } else if ((field.getType().equals(float.class)) || (field.getType().equals(Float.class))) { PropertyUtils.setProperty(testBean, field.getName(), 10F); } else if ((field.getType().equals(byte.class)) || (field.getType().equals(Byte.class))) { PropertyUtils.setProperty(testBean, field.getName(), (byte) 10); } else if (field.getType().equals(Date.class)) { PropertyUtils.setProperty(testBean, field.getName(), new Date()); } else if (field.getType().equals(Collection.class)) { // TODO: create a test object of the collection // class specified (if one is specified and // recursively call this method. } } catch (IllegalAccessException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } } catch (InvocationTargetException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } } catch (NoSuchMethodException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } } } } } return testBean; }
From source file:org.jaffa.presentation.portlet.CustomRequestProcessor.java
/** * <p>Try to locate a multipart request handler for this request. First, look * for a mapping-specific handler stored for us under an attribute. If one * is not present, use the global multipart handler, if there is one.</p> * * @param request The HTTP request for which the multipart handler should * be found.// www . java 2s.c o m * @return the multipart handler to use, or null if none is * found. * * @exception ServletException if any exception is thrown while attempting * to locate the multipart handler. */ private static MultipartRequestHandler getMultipartHandler(HttpServletRequest request) throws ServletException { MultipartRequestHandler multipartHandler = null; String multipartClass = (String) request.getAttribute(Globals.MULTIPART_KEY); request.removeAttribute(Globals.MULTIPART_KEY); // Try to initialize the mapping specific request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { log.error("MultipartRequestHandler class \"" + multipartClass + "\" in mapping class not found, " + "defaulting to global multipart class"); } catch (InstantiationException ie) { log.error( "InstantiationException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { log.error( "IllegalAccessException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + iae.getMessage()); } if (multipartHandler != null) { return multipartHandler; } } ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request); multipartClass = moduleConfig.getControllerConfig().getMultipartClass(); // Try to initialize the global request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { throw new ServletException("Cannot find multipart class \"" + multipartClass + "\"" + ", exception: " + cnfe.getMessage()); } catch (InstantiationException ie) { throw new ServletException("InstantiationException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { throw new ServletException("IllegalAccessException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + iae.getMessage()); } if (multipartHandler != null) { return multipartHandler; } } return multipartHandler; }
From source file:com.evolveum.midpoint.prism.xjc.PrismForJAXBUtil.java
private static <T> T getPropertyValue(PrismProperty<?> property, Class<T> requestedType) { if (property == null) { return null; }//from w ww . j av a2 s.co m PrismPropertyValue<?> pvalue = property.getValue(); if (pvalue == null) { return null; } Object propertyRealValue = pvalue.getValue(); if (propertyRealValue instanceof Element) { if (requestedType.isAssignableFrom(Element.class)) { return (T) propertyRealValue; } Field anyField = getAnyField(requestedType); if (anyField == null) { throw new IllegalArgumentException("Attempt to read raw property " + property + " while the requested class (" + requestedType + ") does not have 'any' field"); } anyField.setAccessible(true); Collection<?> anyElementList = property.getRealValues(); T requestedTypeInstance; try { requestedTypeInstance = requestedType.newInstance(); anyField.set(requestedTypeInstance, anyElementList); } catch (InstantiationException e) { throw new IllegalArgumentException("Instantiate error while reading raw property " + property + ", requested class (" + requestedType + "):" + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalArgumentException( "Illegal access error while reading raw property " + property + ", requested class (" + requestedType + ")" + ", field " + anyField + ": " + e.getMessage(), e); } return requestedTypeInstance; } return JaxbTypeConverter.mapPropertyRealValueToJaxb(propertyRealValue); }
From source file:BrowserLauncher.java
/** * Called by a static initializer to load any classes, fields, and methods required at runtime * to locate the user's web browser.//ww w . jav a 2s. com * @return <code>true</code> if all intialization succeeded * <code>false</code> if any portion of the initialization failed */ private static boolean loadClasses() { switch (jvm) { case MRJ_2_0: try { Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget"); Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils"); Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent"); Class aeClass = Class.forName("com.apple.MacOS.ae"); aeDescClass = Class.forName("com.apple.MacOS.AEDesc"); aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] { int.class }); appleEventConstructor = appleEventClass.getDeclaredConstructor( new Class[] { int.class, int.class, aeTargetClass, int.class, int.class }); aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] { String.class }); makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class[] { String.class }); putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] { int.class, aeDescClass }); sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[] {}); Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject"); keyDirectObject = (Integer) keyDirectObjectField.get(null); Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID"); kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null); Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID"); kAnyTransactionID = (Integer) anyTransactionIDField.get(null); } catch (ClassNotFoundException cnfe) { errorMessage = cnfe.getMessage(); return false; } catch (NoSuchMethodException nsme) { errorMessage = nsme.getMessage(); return false; } catch (NoSuchFieldException nsfe) { errorMessage = nsfe.getMessage(); return false; } catch (IllegalAccessException iae) { errorMessage = iae.getMessage(); return false; } break; case MRJ_2_1: try { mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType"); Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType"); kSystemFolderType = systemFolderField.get(null); findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] { mrjOSTypeClass }); getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[] { File.class }); getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] { File.class }); } catch (ClassNotFoundException cnfe) { errorMessage = cnfe.getMessage(); return false; } catch (NoSuchFieldException nsfe) { errorMessage = nsfe.getMessage(); return false; } catch (NoSuchMethodException nsme) { errorMessage = nsme.getMessage(); return false; } catch (SecurityException se) { errorMessage = se.getMessage(); return false; } catch (IllegalAccessException iae) { errorMessage = iae.getMessage(); return false; } break; case MRJ_3_0: try { Class linker = Class.forName("com.apple.mrj.jdirect.Linker"); Constructor constructor = linker.getConstructor(new Class[] { Class.class }); linkage = constructor.newInstance(new Object[] { BrowserLauncher.class }); } catch (ClassNotFoundException cnfe) { errorMessage = cnfe.getMessage(); return false; } catch (NoSuchMethodException nsme) { errorMessage = nsme.getMessage(); return false; } catch (InvocationTargetException ite) { errorMessage = ite.getMessage(); return false; } catch (InstantiationException ie) { errorMessage = ie.getMessage(); return false; } catch (IllegalAccessException iae) { errorMessage = iae.getMessage(); return false; } break; case MRJ_3_1: try { mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", new Class[] { String.class }); } catch (ClassNotFoundException cnfe) { errorMessage = cnfe.getMessage(); return false; } catch (NoSuchMethodException nsme) { errorMessage = nsme.getMessage(); return false; } break; default: break; } return true; }
From source file:org.kuali.rice.core.framework.persistence.jpa.metadata.MetadataManager.java
/** * Retrieves the primary key as an object for the given Object (which is assumed to be a JPA entity). If the entity has a single field * primary key, the value of that field is returned. If a composite key is needed, it will be constructed and populated with the correct * values. If a problem occurs, a null will be returned * // www .j av a 2 s .c o m * @param object the object to get a primary key value from * @return a primary key value */ public static Object getEntityPrimaryKeyObject(Object object) { final EntityDescriptor descriptor = getEntityDescriptor(object.getClass()); final Class idClass = descriptor.getIdClass(); if (idClass != null) { try { Object pkObject = idClass.newInstance(); for (FieldDescriptor fieldDescriptor : descriptor.getPrimaryKeys()) { Field field = getField(object.getClass(), fieldDescriptor.getName()); field.setAccessible(true); final Object value = field.get(object); if (value != null) { final Field fieldToSet = getField(pkObject.getClass(), fieldDescriptor.getName()); fieldToSet.setAccessible(true); fieldToSet.set(pkObject, value); } } return pkObject; } catch (SecurityException se) { LOG.error(se.getMessage(), se); } catch (InstantiationException ie) { LOG.error(ie.getMessage(), ie); } catch (IllegalAccessException iae) { LOG.error(iae.getMessage(), iae); } catch (NoSuchFieldException nsfe) { LOG.error(nsfe.getMessage(), nsfe); } } else { for (FieldDescriptor fieldDescriptor : descriptor.getPrimaryKeys()) { try { Field field = getField(object.getClass(), fieldDescriptor.getName()); field.setAccessible(true); return field.get(object); // there's only one value, let's kick out } catch (Exception e) { LOG.error(e.getMessage(), e); } } } return null; }
From source file:org.kuali.rice.core.framework.persistence.jpa.metadata.MetadataManager.java
/** * Retrieves the primary key as an object for the given Object (which is assumed to be a JPA entity), filling it with values from the extension. * If the entity has a single field primary key, the value of that field from the extension is returned. If a composite key is needed, it will be * constructed (based on the id class for the extension object) and populated with the correct values from the extension. If a problem occurs, * a null will be returned.//from w w w. j a v a2 s . c o m * * @param owner the object to get values from * @param extension the object to build a key for * @return a primary key value */ public static Object getPersistableBusinessObjectPrimaryKeyObjectWithValuesForExtension(Object owner, Object extension) { final EntityDescriptor descriptor = getEntityDescriptor(extension.getClass()); final Class idClass = descriptor.getIdClass(); if (idClass != null) { try { Object pkObject = idClass.newInstance(); for (FieldDescriptor fieldDescriptor : descriptor.getPrimaryKeys()) { Field field = getField(owner.getClass(), fieldDescriptor.getName()); field.setAccessible(true); final Object value = field.get(owner); if (value != null) { final Field fieldToSet = getField(pkObject.getClass(), fieldDescriptor.getName()); fieldToSet.setAccessible(true); fieldToSet.set(pkObject, value); } } return pkObject; } catch (SecurityException se) { LOG.error(se.getMessage(), se); } catch (InstantiationException ie) { LOG.error(ie.getMessage(), ie); } catch (IllegalAccessException iae) { LOG.error(iae.getMessage(), iae); } catch (NoSuchFieldException nsfe) { LOG.error(nsfe.getMessage(), nsfe); } } else { for (FieldDescriptor fieldDescriptor : descriptor.getPrimaryKeys()) { try { Field field = getField(owner.getClass(), fieldDescriptor.getName()); field.setAccessible(true); final Object value = field.get(owner); return value; // there's only one value, let's kick out } catch (Exception e) { LOG.error(e.getMessage(), e); } } } return null; }
From source file:BrowserLauncher.java
/** * Attempts to locate the default web browser on the local system. Caches results so it * only locates the browser once for each use of this class per JVM instance. * @return The browser for the system. Note that this may not be what you would consider * to be a standard web browser; instead, it's the application that gets called to * open the default web browser. In some cases, this will be a non-String object * that provides the means of calling the default browser. */// w ww .jav a 2s .c o m private static Object locateBrowser() { if (browser != null) { return browser; } switch (jvm) { case MRJ_2_0: try { Integer finderCreatorCode = (Integer) makeOSType.invoke(null, new Object[] { FINDER_CREATOR }); Object aeTarget = aeTargetConstructor.newInstance(new Object[] { finderCreatorCode }); Integer gurlType = (Integer) makeOSType.invoke(null, new Object[] { GURL_EVENT }); Object appleEvent = appleEventConstructor.newInstance( new Object[] { gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID }); // Don't set browser = appleEvent because then the next time we call // locateBrowser(), we'll get the same AppleEvent, to which we'll already have // added the relevant parameter. Instead, regenerate the AppleEvent every time. // There's probably a way to do this better; if any has any ideas, please let // me know. return appleEvent; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InstantiationException ie) { browser = null; errorMessage = ie.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getMessage(); return browser; } case MRJ_2_1: File systemFolder; try { systemFolder = (File) findFolder.invoke(null, new Object[] { kSystemFolderType }); } catch (IllegalArgumentException iare) { browser = null; errorMessage = iare.getMessage(); return browser; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage(); return browser; } String[] systemFolderFiles = systemFolder.list(); // Avoid a FilenameFilter because that can't be stopped mid-list for (int i = 0; i < systemFolderFiles.length; i++) { try { File file = new File(systemFolder, systemFolderFiles[i]); if (!file.isFile()) { continue; } // We're looking for a file with a creator code of 'MACS' and // a type of 'FNDR'. Only requiring the type results in non-Finder // applications being picked up on certain Mac OS 9 systems, // especially German ones, and sending a GURL event to those // applications results in a logout under Multiple Users. Object fileType = getFileType.invoke(null, new Object[] { file }); if (FINDER_TYPE.equals(fileType.toString())) { Object fileCreator = getFileCreator.invoke(null, new Object[] { file }); if (FINDER_CREATOR.equals(fileCreator.toString())) { browser = file.toString(); // Actually the Finder, but that's OK return browser; } } } catch (IllegalArgumentException iare) { browser = browser; errorMessage = iare.getMessage(); return null; } catch (IllegalAccessException iae) { browser = null; errorMessage = iae.getMessage(); return browser; } catch (InvocationTargetException ite) { browser = null; errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage(); return browser; } } browser = null; break; case MRJ_3_0: case MRJ_3_1: browser = ""; // Return something non-null break; case WINDOWS_NT: browser = "cmd.exe"; break; case WINDOWS_9x: browser = "command.com"; break; case OTHER: default: browser = "firefox"; break; } return browser; }
From source file:org.hyperic.hq.plugin.mysql_stats.MySqlServerDetector.java
private static final Connection getConnection(String url, String user, String pass,//from w ww . j av a 2 s .c o m ConfigResponse config) throws SQLException { final String d = MySqlStatsMeasurementPlugin.DEFAULT_DRIVER; try { Driver driver = (Driver) Class.forName(d).newInstance(); final Properties props = new Properties(); pass = (pass == null) ? "" : pass; props.put("user", user); props.put("password", pass); return driver.connect(url, props); } catch (InstantiationException e) { throw new SQLException(e.getMessage()); } catch (IllegalAccessException e) { throw new SQLException(e.getMessage()); } catch (ClassNotFoundException e) { throw new SQLException(e.getMessage()); } }
From source file:BrowserLauncher.java
/** * Attempts to open the default web browser to the given URL. * @param url The URL to open/*w w w . j av a 2 s . c o m*/ * @throws IOException If the web browser could not be located or does not run */ public static void openURL(String url) throws IOException { if (!loadedWithoutErrors) { throw new IOException("Exception in finding browser: " + errorMessage); } Object browser = locateBrowser(); if (browser == null) { throw new IOException("Unable to locate browser: " + errorMessage); } switch (jvm) { case MRJ_2_0: Object aeDesc = null; try { aeDesc = aeDescConstructor.newInstance(new Object[] { url }); putParameter.invoke(browser, new Object[] { keyDirectObject, aeDesc }); sendNoReply.invoke(browser, new Object[] {}); } catch (InvocationTargetException ite) { throw new IOException("InvocationTargetException while creating AEDesc: " + ite.getMessage()); } catch (IllegalAccessException iae) { throw new IOException("IllegalAccessException while building AppleEvent: " + iae.getMessage()); } catch (InstantiationException ie) { throw new IOException("InstantiationException while creating AEDesc: " + ie.getMessage()); } finally { aeDesc = null; // Encourage it to get disposed if it was created browser = null; // Ditto } break; case MRJ_2_1: Runtime.getRuntime().exec(new String[] { (String) browser, url }); break; case MRJ_3_0: int[] instance = new int[1]; int result = ICStart(instance, 0); if (result == 0) { int[] selectionStart = new int[] { 0 }; byte[] urlBytes = url.getBytes(); int[] selectionEnd = new int[] { urlBytes.length }; result = ICLaunchURL(instance[0], new byte[] { 0 }, urlBytes, urlBytes.length, selectionStart, selectionEnd); if (result == 0) { // Ignore the return value; the URL was launched successfully // regardless of what happens here. ICStop(instance); } else { throw new IOException("Unable to launch URL: " + result); } } else { throw new IOException("Unable to create an Internet Config instance: " + result); } break; case MRJ_3_1: try { openURL.invoke(null, new Object[] { url }); } catch (InvocationTargetException ite) { throw new IOException("InvocationTargetException while calling openURL: " + ite.getMessage()); } catch (IllegalAccessException iae) { throw new IOException("IllegalAccessException while calling openURL: " + iae.getMessage()); } break; case WINDOWS_NT: case WINDOWS_9x: // Add quotes around the URL to allow ampersands and other special // characters to work. Process process = Runtime.getRuntime().exec(new String[] { (String) browser, FIRST_WINDOWS_PARAMETER, SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER, '"' + url + '"' }); // This avoids a memory leak on some versions of Java on Windows. // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>. try { process.waitFor(); process.exitValue(); } catch (InterruptedException ie) { throw new IOException("InterruptedException while launching browser: " + ie.getMessage()); } break; case OTHER: // Assume that we're on Unix and that Netscape is installed // First, attempt to open the URL in a currently running session of Netscape process = Runtime.getRuntime().exec(new String[] { (String) browser, NETSCAPE_REMOTE_PARAMETER, NETSCAPE_OPEN_PARAMETER_START + url + NETSCAPE_OPEN_PARAMETER_END }); try { int exitCode = process.waitFor(); if (exitCode != 0) { // if Netscape was not open Runtime.getRuntime().exec(new String[] { (String) browser, url }); } } catch (InterruptedException ie) { throw new IOException("InterruptedException while launching browser: " + ie.getMessage()); } break; default: // This should never occur, but if it does, we'll try the simplest thing possible Runtime.getRuntime().exec(new String[] { (String) browser, url }); break; } }
From source file:org.kuali.rice.kns.web.ui.FieldBridge.java
/** * This method will return a new form for adding in a BO for a collection. * This should be customized in a subclass so the default behavior is to return nothing. * * @param collectionDefinition The DD definition for the Collection. * @param o The BusinessObject form which the new Fields will be populated. * @param document MaintenanceDocument instance which we ar building fields for * @param m/*from w w w .ja v a 2 s . c o m*/ * @param displayedFieldNames What Fields are being displayed on the form in the UI? * @param containerRowErrorKey The error key for the Container/Collection used for displaying error messages. * @param parents * @param hideAdd Should the add line be hidden when displaying this Collection/Container in the UI? * @param numberOfColumns How many columns the Fields in the Collection will be split into when displaying them in the UI. * * @return The List of new Fields. */ public static final List<Field> getNewFormFields(CollectionDefinitionI collectionDefinition, BusinessObject o, Maintainable m, List<String> displayedFieldNames, Set<String> conditionallyRequiredMaintenanceFields, StringBuffer containerRowErrorKey, String parents, boolean hideAdd, int numberOfColumns) { LOG.debug("getNewFormFields"); String collName = collectionDefinition.getName(); List<Field> collFields = new ArrayList<Field>(); Collection<? extends FieldDefinitionI> collectionFields; //Class boClass = collectionDefinition.getDataObjectClass(); BusinessObject collBO = null; try { collectionFields = collectionDefinition.getFields(); collBO = m.getNewCollectionLine(parents + collName); if (LOG.isDebugEnabled()) { LOG.debug("newBO for add line: " + collBO); } for (FieldDefinitionI fieldDefinition : collectionFields) { // construct Field UI object from definition Field collField = FieldUtils.getPropertyField(collectionDefinition.getBusinessObjectClass(), fieldDefinition.getName(), false); if (fieldDefinition instanceof MaintainableFieldDefinition) { setupField(collField, fieldDefinition, conditionallyRequiredMaintenanceFields); } //generate the error key for the add row String[] nameParts = StringUtils.split(collField.getPropertyName(), "."); String fieldErrorKey = KRADConstants.MAINTENANCE_NEW_MAINTAINABLE + KRADConstants.ADD_PREFIX + "."; fieldErrorKey += collName + "."; for (int i = 0; i < nameParts.length; i++) { fieldErrorKey += nameParts[i]; containerRowErrorKey.append(fieldErrorKey); if (i < nameParts.length) { fieldErrorKey += "."; containerRowErrorKey.append(","); } } // set the QuickFinderClass BusinessObject collectionBoInstance = collectionDefinition.getBusinessObjectClass().newInstance(); FieldUtils.setInquiryURL(collField, collectionBoInstance, fieldDefinition.getName()); if (collectionDefinition instanceof MaintainableCollectionDefinition) { MaintenanceUtils.setFieldQuickfinder(collectionBoInstance, parents + collectionDefinition.getName(), true, 0, fieldDefinition.getName(), collField, displayedFieldNames, m, (MaintainableFieldDefinition) fieldDefinition); MaintenanceUtils.setFieldDirectInquiry(collectionBoInstance, parents + collectionDefinition.getName(), true, 0, fieldDefinition.getName(), collField, displayedFieldNames, m, (MaintainableFieldDefinition) fieldDefinition); } else { LookupUtils.setFieldQuickfinder(collectionBoInstance, parents + collectionDefinition.getName(), true, 0, fieldDefinition.getName(), collField, displayedFieldNames, m); LookupUtils.setFieldDirectInquiry(collectionBoInstance, fieldDefinition.getName(), collField); } collFields.add(collField); } } catch (InstantiationException e) { LOG.error("Unable to create instance of object class" + e.getMessage()); throw new RuntimeException("Unable to create instance of object class" + e.getMessage()); } catch (IllegalAccessException e) { LOG.error("Unable to create instance of object class" + e.getMessage()); throw new RuntimeException("Unable to create instance of object class" + e.getMessage()); } // populate field values from business object collFields = FieldUtils.populateFieldsFromBusinessObject(collFields, collBO); // need to append the prefix afterwards since the population command (above) // does not handle the prefixes on the property names for (Field field : collFields) { // prefix name for add line field.setPropertyName(KRADConstants.MAINTENANCE_ADD_PREFIX + parents + collectionDefinition.getName() + "." + field.getPropertyName()); } LOG.debug("Error Key for section " + collectionDefinition.getName() + " : " + containerRowErrorKey.toString()); collFields = constructContainerField(collectionDefinition, parents, o, hideAdd, numberOfColumns, collName, collFields); return collFields; }