Example usage for java.lang IllegalAccessException getMessage

List of usage examples for java.lang IllegalAccessException getMessage

Introduction

In this page you can find the example usage for java.lang IllegalAccessException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.fiz.ddb.aas.auxiliaryoperations.ThreadOrganisationUpdate.java

@PreAuthorize(privileges = { PrivilegeEnum.ADMIN_ORG,
        PrivilegeEnum.ADMIN }, scope = Scope.ORGANIZATION, cacheUpdate = true)
public Organisation call() throws NameNotFoundException, AASUnauthorizedException,
        AttributeModificationException, ExecutionException {
    try {//from   w  ww .  j a  v  a  2  s.com

        LOG.log(Level.INFO, "Update an organization with ID: ''{0}''", this._organisation.getOIDs());

        ThreadOrganisationRead threadOrganisationRead = new ThreadOrganisationRead(this._organisation.getOIDs(),
                getPerformer());
        threadOrganisationRead.setLicensedOrgs(isUpdatingOfLicensedOrgs());
        // -- if not found, throw NameNotFoundException:
        _oldOrganisation = threadOrganisationRead.call();

        if (!isChangeOfStatus()) {

            if (!_oldOrganisation.getStatus().equals(_organisation.getStatus())) {
                LOG.log(Level.WARNING,
                        "It is only an explicit change of status possible! The old value '"
                                + _oldOrganisation.getStatus() + "' is put back (The new value was: '"
                                + _organisation.getStatus() + "').");
                this._organisation.setStatus(_oldOrganisation.getStatus());
            }

            if (_oldOrganisation.getAddress() != null) {

                // -- wesentliche Adressdaten wurden gendert:
                boolean vAddressHasBeenChanged = (!_oldOrganisation.getAddress()
                        .equalsWithoutGeocoding(this._organisation.getAddress()));

                // -- Abfrageforderung:
                boolean vQueryRequestForGeocoding = ((Math
                        .abs(this._organisation.getAddress().getLatitude()) <= 1e-6)
                        || (Math.abs(this._organisation.getAddress().getLongitude()) <= 1e-6));

                // -- Die Geokoordinaten sollten - dem Input entsprechend, gendert werden:
                boolean vGeocodingShouldBeChanged = (Math.abs(this._organisation.getAddress().getLatitude()
                        - _oldOrganisation.getAddress().getLatitude()) >= 1e-6)
                        || (Math.abs(this._organisation.getAddress().getLongitude()
                                - _oldOrganisation.getAddress().getLongitude()) >= 1e-6);

                LOG.log(Level.INFO,
                        "AddressHasBeenChanged = {0}, QueryRequestForGeocoding = {1}, GeocodingShouldBeChanged = {2}",
                        new Object[] { vAddressHasBeenChanged, vQueryRequestForGeocoding,
                                vGeocodingShouldBeChanged });

                if ((vQueryRequestForGeocoding) || (vAddressHasBeenChanged && !vGeocodingShouldBeChanged)) {
                    try {
                        GeoRequest vGeoRequest = new GeoRequest(new GeoAdresse(this._organisation.getAddress()),
                                LDAPConnector.getSingletonInstance().getHttpProxy());
                        vGeoRequest.setAskForLocation(true);
                        // -- should be set by Properties... change it!
                        vGeoRequest.addAcceptLocationType(GeoLocationType.ROOFTOP,
                                GeoLocationType.RANGE_INTERPOLATED, GeoLocationType.GEOMETRIC_CENTER,
                                GeoLocationType.APPROXIMATE);
                        _submit = LDAPConnector.getSingletonInstance().getExecutorServiceOne()
                                .submit(vGeoRequest);
                    } catch (IllegalAccessException ex) {
                        LOG.log(Level.SEVERE, "Error bei Adresse: " + this._organisation.getAddress(), ex);
                    }
                } else if (vGeocodingShouldBeChanged) {
                    try {
                        GeoLocationDisplayNameRequest vGeoLocDisplayNameRequest = new GeoLocationDisplayNameRequest(
                                this._organisation.getAddress().getLatitude(),
                                this._organisation.getAddress().getLongitude(),
                                LDAPConnector.getSingletonInstance().getHttpProxy() //Proxy.NO_PROXY
                        );
                        _submitGeoLocDisplayName = LDAPConnector.getSingletonInstance().getExecutorServiceOne()
                                .submit(vGeoLocDisplayNameRequest);
                        //LOG.info("Gestartet: '" + vGeoLocDisplayNameRequest.getUrlBase() + "...'");
                    } catch (IllegalAccessException ex) {
                        LOG.log(Level.WARNING, this._organisation.getAddress()
                                + " without location display name: " + ex.getMessage());
                    }

                }
            }
        }
        this.updateOrg();
    } catch (AASUnauthorizedException ex) {
        LOG.log(Level.SEVERE, ex.getMessage(), ex);
        throw ex;
    } finally {
        try {
            if ((_submitGeoLocDisplayName != null) && (!_submitGeoLocDisplayName.isDone())
                    && (!_submitGeoLocDisplayName.isCancelled())) {
                _submitGeoLocDisplayName.cancel(true);
                _submitGeoLocDisplayName = null;
            }
        } catch (Exception ex) {
        }
        try {
            if ((_submit != null) && (!_submit.isDone()) && (!_submit.isCancelled())) {
                _submit.cancel(true);
                _submit = null;
            }
        } catch (Exception ex) {
        }

    }
    return this._organisation;
}

From source file:org.dasein.persist.PersistentCache.java

private @Nonnull JSONObject autoJSON(@Nonnull Object ob) {
    HashMap<String, Object> json = new HashMap<String, Object>();
    Class<?> cls = ob.getClass();

    while (!(cls.getName().equals(Object.class.getName()))) {
        Field[] fields = cls.getDeclaredFields();

        for (Field field : fields) {
            int modifiers = field.getModifiers();

            if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers)) {
                continue;
            }//from  ww w  . j  ava 2s  . c  o m
            field.setAccessible(true);
            try {
                Object value = field.get(ob);

                value = toJSONValue(value);
                json.put(field.getName(), value);
            } catch (IllegalAccessException e) {
                // this should not happen, don't map
                logger.warn("Illegal access exception mapping " + cls.getName() + "." + field.getName() + ": "
                        + e.getMessage(), e);
            }
        }
        cls = cls.getSuperclass();
    }
    return new JSONObject(json);
}

From source file:org.springframework.data.mongodb.core.MongoTemplate.java

/**
 * Populates the id property of the saved object, if it's not set already.
 * /*from w w  w.j a v a 2s .com*/
 * @param savedObject
 * @param id
 */
protected void populateIdIfNecessary(Object savedObject, Object id) {

    if (id == null) {
        return;
    }

    MongoPersistentProperty idProp = getIdPropertyFor(savedObject.getClass());

    if (idProp == null) {
        return;
    }

    ConversionService conversionService = mongoConverter.getConversionService();
    BeanWrapper<PersistentEntity<Object, ?>, Object> wrapper = BeanWrapper.create(savedObject,
            conversionService);

    try {

        Object idValue = wrapper.getProperty(idProp, idProp.getType(), true);

        if (idValue != null) {
            return;
        }

        wrapper.setProperty(idProp, id);

    } catch (IllegalAccessException e) {
        throw new MappingException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new MappingException(e.getMessage(), e);
    }
}

From source file:org.egov.pims.service.EmployeeServiceImpl.java

public Map getMapForList(List list) {
    Map<Integer, String> retMap = new LinkedHashMap<Integer, String>();
    try {/*from w ww.  j a  v a2 s .c om*/

        for (Iterator iter = list.iterator(); iter.hasNext();) {
            Object object = (Object) iter.next();
            Class classObj = object.getClass();

            Field id = classObj.getField("id");
            Field name = classObj.getField("name");
            retMap.put((Integer) id.get(object), (String) name.get(object));

        }
    } catch (NoSuchFieldException nfe) {
        throw new ApplicationRuntimeException("Exception:" + nfe.getMessage(), nfe);
    } catch (IllegalAccessException iac) {
        throw new ApplicationRuntimeException("Exception:" + iac.getMessage(), iac);
    }
    return retMap;

}

From source file:org.egov.pims.service.EmployeeServiceImpl.java

/**
 * Returns Map for a given list//from w  w  w.  j ava 2s  . c o m
 * 
 * @param list
 * @return
 */
public Map getMapForList(List list, String fieldName1, String fieldName2) {
    Map<Integer, String> retMap = new LinkedHashMap<Integer, String>();
    try {
        String id = null;
        String name = null;
        Long longObj = null;
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            Object object = (Object) iter.next();

            id = (String) BeanUtils.getProperty(object, fieldName1);
            name = (String) BeanUtils.getProperty(object, fieldName2);
            if (id != null) {
                retMap.put(Integer.valueOf(id), (String) name);
            }
        }
    } catch (IllegalAccessException iac) {

        throw new ApplicationRuntimeException("Exception:" + iac.getMessage(), iac);
    } catch (InvocationTargetException e) {
        LOGGER.error(e);
        throw new ApplicationRuntimeException("Exception:" + e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        LOGGER.error(e);
        throw new ApplicationRuntimeException("Exception:" + e.getMessage(), e);
    }
    return retMap;

}

From source file:com.ucuenca.pentaho.plugin.step.EldaPDIStepDialog.java

private String lookupGetterMethod(String nameMethod) {
    String value = "";
    for (StepMeta stepMeta : this.transMeta.findPreviousSteps(this.stepMeta)) {

        StepMetaInterface stepMetaIn = stepMeta.getStepMetaInterface();

        try {//from   w  w w .  j a va 2 s.c o m
            for (Method method : stepMetaIn.getClass().getDeclaredMethods()) {
                if (method.getName().equals(nameMethod)) {
                    value = (String) method.invoke(stepMetaIn);
                    break;
                }
            }
        } catch (IllegalAccessException ne) {
            logBasic(ne.getMessage());
            value = "";
        } catch (IllegalArgumentException se) {
            logBasic(se.getMessage());
            value = "";
        } catch (InvocationTargetException ae) {
            logBasic(ae.getMessage());
            value = "";
        } finally {
            if (value != null)
                break;
        }
    }
    return value;
}

From source file:org.openengsb.core.persistence.internal.SerializableChecker.java

private void internalCheck(Object obj) {
    if (obj == null) {
        return;//from w  w  w. j a  v a 2  s  .  co m
    }
    Class<?> cls = obj.getClass();
    nameStack.add(simpleName);
    traceStack.add(new TraceSlot(obj, fieldDescription));
    if (!(obj instanceof Serializable) && (!Proxy.isProxyClass(cls))) {
        throw new ObjectDbNotSerializableException(toPrettyPrintedStack(obj.getClass().getName()), exception);
    }
    ObjectStreamClass desc;
    for (;;) {
        try {
            desc = (ObjectStreamClass) lookupMethod.invoke(null, cls, Boolean.TRUE);
            obj = invokeWriteReplaceMethod.invoke(desc, obj);
            Class<?> repCl = obj.getClass();
            if (!(Boolean) hasWriteReplaceMethodMetod.invoke(desc, (Object[]) null) || obj == null
                    || repCl == cls) {
                break;
            }
            cls = repCl;
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
    if (cls.isPrimitive()) {
        LOGGER.trace("skip primitive check");
    } else if (cls.isArray()) {
        checked.put(obj, null);
        Class<?> ccl = cls.getComponentType();
        if (!(ccl.isPrimitive())) {
            Object[] objs = (Object[]) obj;
            for (int i = 0; i < objs.length; i++) {
                String arrayPos = "[" + i + "]";
                simpleName = arrayPos;
                fieldDescription += arrayPos;
                check(objs[i]);
            }
        }
    } else if (obj instanceof Externalizable && (!Proxy.isProxyClass(cls))) {
        Externalizable extObj = (Externalizable) obj;
        try {
            extObj.writeExternal(new ObjectOutputAdaptor() {
                private int count = 0;

                @Override
                public void writeObject(Object streamObj) throws IOException {
                    if (checked.containsKey(streamObj)) {
                        return;
                    }

                    checked.put(streamObj, null);
                    String arrayPos = "[write:" + count++ + "]";
                    simpleName = arrayPos;
                    fieldDescription += arrayPos;

                    check(streamObj);
                }
            });
        } catch (Exception e) {
            if (e instanceof ObjectDbNotSerializableException) {
                throw (ObjectDbNotSerializableException) e;
            }
            LOGGER.warn("error delegating to Externalizable : " + e.getMessage() + ", path: " + currentPath());
        }
    } else {
        Method writeObjectMethod = null;
        if (!writeObjectMethodMissing.contains(cls)) {
            try {
                writeObjectMethod = cls.getDeclaredMethod("writeObject",
                        new Class[] { java.io.ObjectOutputStream.class });
            } catch (SecurityException e) {
                writeObjectMethodMissing.add(cls);
            } catch (NoSuchMethodException e) {
                writeObjectMethodMissing.add(cls);
            }
        }
        final Object original = obj;
        if (writeObjectMethod != null) {
            class InterceptingObjectOutputStream extends ObjectOutputStream {
                private int counter;

                InterceptingObjectOutputStream() throws IOException {
                    super(DUMMY_OUTPUT_STREAM);
                    enableReplaceObject(true);
                }

                @Override
                protected Object replaceObject(Object streamObj) throws IOException {
                    if (streamObj == original) {
                        return streamObj;
                    }
                    counter++;
                    if (checked.containsKey(streamObj)) {
                        return null;
                    }
                    checked.put(streamObj, null);
                    String arrayPos = "[write:" + counter + "]";
                    simpleName = arrayPos;
                    fieldDescription += arrayPos;
                    check(streamObj);
                    return streamObj;
                }
            }
            InterceptingObjectOutputStream ioos = null;
            try {
                ioos = new InterceptingObjectOutputStream();
                ioos.writeObject(obj);
            } catch (Exception e) {
                if (e instanceof ObjectDbNotSerializableException) {
                    throw (ObjectDbNotSerializableException) e;
                }
                LOGGER.warn("error delegating to writeObject : " + e.getMessage() + ", path: " + currentPath());
            } finally {
                IOUtils.closeQuietly(ioos);
            }
        } else {
            Object[] slots;
            try {
                slots = (Object[]) getClassDataLayoutMethod.invoke(desc, (Object[]) null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            for (Object slot : slots) {
                ObjectStreamClass slotDesc;
                try {
                    Field descField = slot.getClass().getDeclaredField("desc");
                    descField.setAccessible(true);
                    slotDesc = (ObjectStreamClass) descField.get(slot);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                checked.put(obj, null);
                checkFields(obj, slotDesc);
            }
        }
    }
    traceStack.removeLast();
    nameStack.removeLast();
}

From source file:org.vulpe.controller.AbstractVulpeBaseController.java

/**
 * Method to repair cached classes used by entity.
 *
 * @param entity/*  w w  w . jav  a  2s.  c om*/
 * @return Entity with cached values reloaded
 */
protected ENTITY repairCachedClasses(final ENTITY entity) {
    final List<Field> fields = VulpeReflectUtil.getFields(entity.getClass());
    for (final Field field : fields) {
        if (VulpeEntity.class.isAssignableFrom(field.getType())) {
            try {
                final VulpeEntity<ID> value = (VulpeEntity<ID>) PropertyUtils.getProperty(entity,
                        field.getName());
                if (VulpeValidationUtil.isNotEmpty(value) && !Modifier.isTransient(field.getModifiers())
                        && value.getClass().isAnnotationPresent(CachedClass.class)) {
                    final List<ENTITY> cachedList = vulpe.cache().classes()
                            .getAuto(value.getClass().getSimpleName());
                    if (VulpeValidationUtil.isNotEmpty(cachedList)) {
                        for (final ENTITY cached : cachedList) {
                            if (cached.getId().equals(value.getId())) {
                                PropertyUtils.setProperty(entity, field.getName(), cached);
                                break;
                            }
                        }
                    }
                }
            } catch (IllegalAccessException e) {
                LOG.error(e.getMessage());
            } catch (InvocationTargetException e) {
                LOG.error(e.getMessage());
            } catch (NoSuchMethodException e) {
                LOG.error(e.getMessage());
            }
        }
    }
    return entity;
}

From source file:jp.terasoluna.fw.validation.FieldChecks.java

/**
 * ???//  www  . ja  va 2 s . co  m
 *
 * ?????{@link MultiFieldValidator} ???<br>
 * ??? <code>validation.xml</code> ??<br>
 * ???????????
 * ????
 * ???????????
 * ? <code>validation.xml</code> ?????<br>
 * value???value1??
 * value2????????????
 * ?
 * <h5>{@link MultiFieldValidator} ?</h5>
 * <code><pre>
 * public boolean validate(Object value, Object[] depends) {
 *     int value0 = Integer.parseInt(value);
 *     int value1 = Integer.parseInt(depends[0]);
 *     int value2 = Integer.parseInt(depends[1]);
 *     return (value1 <= value0 && value2 >= value0);
 * }
 * </pre></code>
 * <h5>validation.xml?</h5>
 * <code><pre>
 * &lt;form name=&quot;/validateMultiField&quot;&gt;
 *   &lt;field property=&quot;value&quot; depends=&quot;multiField&quot;&gt;
 *     &lt;msg key=&quot;errors.multiField&quot;
 *             name=&quot;multiField&quot;/&gt;
 *     &lt;arg key=&quot;label.value&quot; position=&quot;0&quot; /&gt;
 *     &lt;arg key=&quot;label.value1&quot; position=&quot;1&quot; /&gt;
 *     &lt;arg key=&quot;label.value2&quot; position=&quot;2&quot; /&gt;
 *     &lt;var&gt;
 *       &lt;var-name&gt;fields&lt;/var-name&gt;
 *       &lt;var-value&gt;value1,value2&lt;/var-value&gt;
 *     &lt;/var&gt;
 *     &lt;var&gt;
 *       &lt;var-name&gt;multiFieldValidator&lt;/var-name&gt;
 *       &lt;var-value&gt;sample.SampleMultiFieldValidator&lt;/var-value&gt;
 *     &lt;/var&gt;
 *   &lt;/field&gt;
 * &lt;/form&gt;
 * </pre></code>
 * <h5>?</h5>
 * <code>
 * errors.multiField={0}?{1}?{2}?????????
 * </code>
 *
 * <h5>validation.xml???&lt;var&gt;?</h5>
 * <table border="1">
 *  <tr>
 *   <td><center><b><code>var-name</code></b></center></td>
 *   <td><center><b><code>var-value</code></b></center></td>
 *   <td><center><b></b></center></td>
 *   <td><center><b>?</b></center></td>
 *  </tr>
 *  <tr>
 *   <td> fields </td>
 *   <td>??????</td>
 *   <td>false</td>
 *   <td>???????
 *   ?</td>
 *  </tr>
 *  <tr>
 *   <td> multiFieldValidator </td>
 *   <td>{@link MultiFieldValidator} ??</td>
 *   <td>true</td>
 *   <td>??? {@link MultiFieldValidator}
 *   ??</td>
 *  </tr>
 * </table>
 *
 * @param bean ?
 * @param va Validator????ValidatorAction
 * @param field 
 * @param errors 
 * @return ???? <code>true</code>
 */
public boolean validateMultiField(Object bean, ValidatorAction va, Field field, ValidationErrors errors) {

    // bean?null????true??
    if (bean == null) {
        log.error("bean is null.");
        return true;
    }

    // ??
    Object value = null;
    if (bean instanceof String) {
        value = bean;
    } else {
        try {
            value = PropertyUtils.getProperty(bean, field.getProperty());
        } catch (IllegalAccessException e) {
            log.error(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            log.error(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            log.error(e.getMessage(), e);
        }
    }
    // ????????
    // ?null?????????

    // MultiFieldValidator???
    String multiFieldValidatorClass = field.getVarValue("multiFieldValidator");

    if (multiFieldValidatorClass == null || "".equals(multiFieldValidatorClass)) {
        log.error("var value[multiFieldValidator] is required.");
        throw new IllegalArgumentException("var value[multiFieldValidator] is required.");
    }

    MultiFieldValidator mfv = null;
    try {
        mfv = (MultiFieldValidator) ClassUtil.create(multiFieldValidatorClass);
    } catch (ClassLoadException e) {
        log.error("var value[multiFieldValidator] is invalid.", e);
        throw new IllegalArgumentException("var value[multiFieldValidator] is invalid.", e);
    } catch (ClassCastException e) {
        log.error("var value[multiFieldValidator] is invalid.", e);
        throw new IllegalArgumentException("var value[multiFieldValidator] is invalid.", e);
    }

    // ????
    String fields = field.getVarValue("fields");
    List<Object> valueList = new ArrayList<Object>();
    if (fields != null) {
        StringTokenizer st = new StringTokenizer(fields, ",");
        while (st.hasMoreTokens()) {
            String f = st.nextToken();
            f = f.trim();
            try {
                valueList.add(PropertyUtils.getProperty(bean, f));
            } catch (IllegalAccessException e) {
                log.error(e.getMessage(), e);
            } catch (InvocationTargetException e) {
                log.error(e.getMessage(), e);
            } catch (NoSuchMethodException e) {
                log.error(e.getMessage(), e);
            }
        }
    }

    if (log.isDebugEnabled()) {
        log.debug("dependent fields:" + valueList);
    }

    Object[] values = new Object[valueList.size()];

    valueList.toArray(values);

    boolean result = mfv.validate(value, values);

    if (!result) {
        rejectValue(errors, field, va, bean);
        return false;
    }

    return true;
}

From source file:com.krawler.spring.crm.emailMarketing.crmEmailMarketingController.java

public JSONObject getTargetListJson(List ll) throws ServletException {
    JSONObject jobj = new JSONObject();
    JSONArray jarr = new JSONArray();
    try {//from   w  w w  . jav a2 s  . com
        Iterator ite = ll.iterator();
        while (ite.hasNext()) {
            TargetListTargets obj = (TargetListTargets) ite.next();
            JSONObject jtemp = new JSONObject();
            String name = "";
            String email = "";
            String phone = "";
            String relatedmodule = "";
            String recipientCompany = "";
            boolean putArch = false;
            int putDel = 0;
            String classpath = "";
            switch (obj.getRelatedto()) {

            case 1: // Lead
                classpath = "com.krawler.crm.database.tables.CrmLead";
                Object invoker = KwlCommonTablesDAOObj.getClassObject(classpath, obj.getRelatedid());
                if (invoker != null) {
                    Class cl = invoker.getClass();
                    Class arguments[] = new Class[] {};
                    Object[] obj1 = new Object[] {};

                    java.lang.reflect.Method objMethod = cl.getMethod("getFirstname", arguments);
                    name = (String) objMethod.invoke(invoker, obj1);
                    name = StringUtil.isNullOrEmpty(name) ? "" : name;
                    objMethod = cl.getMethod("getLastname", arguments);
                    name = (StringUtil.checkForNull(name) + " "
                            + StringUtil.checkForNull((String) objMethod.invoke(invoker, obj1))).trim();

                    objMethod = cl.getMethod("getEmail", arguments);
                    email = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getPhone", arguments);
                    phone = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getIsarchive", arguments);
                    putArch = (Boolean) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getDeleteflag", arguments);
                    putDel = (Integer) objMethod.invoke(invoker, obj1);
                    relatedmodule = Constants.MODULE_LEAD;
                }
                break;
            case 2: // Contact
                classpath = "com.krawler.crm.database.tables.CrmContact";
                invoker = KwlCommonTablesDAOObj.getClassObject(classpath, obj.getRelatedid());
                if (invoker != null) {
                    Class cl = invoker.getClass();
                    Class arguments[] = new Class[] {};
                    Object[] obj1 = new Object[] {};

                    java.lang.reflect.Method objMethod = cl.getMethod("getFirstname", arguments);
                    name = (String) objMethod.invoke(invoker, obj1);
                    name = StringUtil.isNullOrEmpty(name) ? "" : name;
                    objMethod = cl.getMethod("getLastname", arguments);
                    name = (StringUtil.checkForNull(name) + " "
                            + StringUtil.checkForNull((String) objMethod.invoke(invoker, obj1))).trim();
                    objMethod = cl.getMethod("getEmail", arguments);
                    email = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getPhoneno", arguments);
                    phone = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getIsarchive", arguments);
                    putArch = (Boolean) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getDeleteflag", arguments);
                    putDel = (Integer) objMethod.invoke(invoker, obj1);
                    relatedmodule = Constants.MODULE_CONTACT;
                }
                break;
            case 3: // Users
                classpath = "com.krawler.common.admin.User";
                invoker = KwlCommonTablesDAOObj.getClassObject(classpath, obj.getRelatedid());
                if (invoker != null) {
                    Class cl = invoker.getClass();
                    Class arguments[] = new Class[] {};
                    Object[] obj1 = new Object[] {};

                    java.lang.reflect.Method objMethod = cl.getMethod("getFirstName", arguments);
                    name = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getLastName", arguments);
                    name = name + " " + (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getEmailID", arguments);
                    email = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getContactNumber", arguments);
                    phone = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getDeleteflag", arguments);
                    putDel = (Integer) objMethod.invoke(invoker, obj1);
                    relatedmodule = Constants.MODULE_USER;
                }
                break;
            case 4: // Target Module
                classpath = "com.krawler.crm.database.tables.TargetModule";
                invoker = KwlCommonTablesDAOObj.getClassObject(classpath, obj.getRelatedid());
                if (invoker != null) {
                    Class cl = invoker.getClass();
                    Class arguments[] = new Class[] {};
                    Object[] obj1 = new Object[] {};

                    java.lang.reflect.Method objMethod = cl.getMethod("getFirstname", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        name = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getLastname", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        name = name + " " + (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getEmail", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        email = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getPhoneno", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        phone = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getIsarchive", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        putArch = (Boolean) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getCompanyname", arguments);
                    if (objMethod.invoke(invoker, obj1) != null)
                        recipientCompany = (String) objMethod.invoke(invoker, obj1);
                    objMethod = cl.getMethod("getDeleteflag", arguments);
                    putDel = (Integer) objMethod.invoke(invoker, obj1);
                    relatedmodule = Constants.MODULE_TARGET;
                }
                break;
            default:
                break;
            }

            jtemp.put("id", obj.getId());
            jtemp.put("name", name);
            jtemp.put("related", relatedmodule);
            jtemp.put("relatedto", obj.getRelatedto());
            jtemp.put("relatedid", obj.getRelatedid());
            jtemp.put("emailid", email);
            jtemp.put("company", recipientCompany);
            jtemp.put("phone", phone);
            if (putArch || putDel == 1) {
            } else {
                jarr.put(jtemp);
            }
        }
        jobj.put("data", jarr);
    } catch (IllegalAccessException e) {
        logger.warn(e.getMessage(), e);
    } catch (IllegalArgumentException e) {
        logger.warn(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        logger.warn(e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        logger.warn(e.getMessage(), e);
    } catch (SecurityException e) {
        logger.warn(e.getMessage(), e);
    } catch (ServiceException e) {
        logger.warn(e.getMessage(), e);
    } catch (JSONException e) {
        logger.warn(e.getMessage(), e);
    }
    return jobj;
}