List of usage examples for javax.ejb CreateException printStackTrace
public void printStackTrace()
From source file:ispyb.client.common.shipping.UploadShipmentAction.java
/** * execute/*from ww w .jav a 2s. co m*/ * * @param args */ @Override public ActionForward execute(ActionMapping mapping, ActionForm actForm, HttpServletRequest request, HttpServletResponse in_response) { try { this.initServices(); } catch (CreateException e) { e.printStackTrace(); } catch (NamingException e) { e.printStackTrace(); } // Retrieve Attributes String reqCode = request.getParameter("reqCode"); if (reqCode.equals("display")) return this.display(mapping, actForm, request, in_response); if (reqCode.equals("displayAfterDewarTracking")) return this.displayAfterDewarTracking(mapping, actForm, request, in_response); // if (reqCode.equals("uploadFile")) // return this.uploadFile(mapping, actForm, request, in_response); if (reqCode.equals("downloadFile")) return this.DownloadFile(mapping, actForm, request, in_response); if (reqCode.equals("exportShipping")) return this.exportShipping(mapping, actForm, request, in_response); return this.display(mapping, actForm, request, in_response); }
From source file:com.idega.company.test.FakeCompanyCreator.java
public Company create(User user, String commune, String postalCode, String address, String bankAccount, Group group, java.sql.Date lastChanged, String name, Boolean isOpen, String personalID, Boolean isValid, String workingArea, String orderAreaForName, String operationForm, String vatNumber, String legalAddress, java.sql.Date registrationDate, String operation, String recipientPersonalId, String recipientName, String industryCode, String unregistrationType, java.sql.Date unregistrationDate, String banMarking) {//from w ww . j av a2s. c o m Company fakeCompany = null; try { fakeCompany = getCompanyHome().create(); } catch (CreateException e) { getLogger().log(Level.WARNING, "Unable to create fake: " + Company.class, e); return null; } fakeCompany.setCEO(user); if (StringUtil.isEmpty(personalID)) { personalID = RandomStringUtils.randomNumeric(10); } fakeCompany.setPersonalID(personalID); if (StringUtil.isEmpty(address)) address = RandomStringUtils.random(20, TestConstants.setOfChars); Address addressBean = fakeCompany.getAddress(); if (addressBean == null) { try { addressBean = getAddressHome().create(); addressBean.setAddressType(getAddressHome().getAddressType1()); addressBean.setStreetName(address); // addressBean.setAddressTypeID(RandomUtils.nextInt(10)); addressBean.setCity("Vilnius"); addressBean.store(); } catch (Exception re) { getLogger().log(Level.SEVERE, "Exception while creating a new address entry", re); return null; } } fakeCompany.setAddress(addressBean); if (StringUtil.isEmpty(commune)) commune = RandomStringUtils.random(20, TestConstants.setOfChars); Commune communeBean = addressBean.getCommune(); if (communeBean == null) { try { communeBean = getCommuneHome().create(); communeBean.setCommuneCode(RandomStringUtils.randomNumeric(10)); communeBean.setCommuneName(commune); communeBean.setCommuneWebsiteURL( "http://www." + RandomStringUtils.random(20, TestConstants.setOfChars) + ".is"); communeBean.store(); } catch (Exception re) { getLogger().log(Level.SEVERE, "Exception while finding commune entry", re); } } addressBean.setCommune(communeBean); if (StringUtil.isEmpty(postalCode)) postalCode = RandomStringUtils.randomNumeric(5); PostalCode postalCodeBean = addressBean.getPostalCode(); if (postalCodeBean == null) { try { postalCodeBean = getPostalCodeHome().create(); postalCodeBean.setPostalCode(postalCode); postalCodeBean.store(); } catch (Exception re) { getLogger().log(Level.SEVERE, "Exception while finding a postal code entry", re); } } addressBean.setPostalCode(postalCodeBean); addressBean.store(); if (StringUtil.isEmpty(workingArea)) workingArea = RandomStringUtils.random(20, TestConstants.setOfChars); fakeCompany.setWorkingArea(communeBean); if (StringUtil.isEmpty(orderAreaForName)) orderAreaForName = RandomStringUtils.random(20, TestConstants.setOfChars); if (StringUtil.isEmpty(name)) name = RandomStringUtils.random(20, TestConstants.setOfChars); fakeCompany.setName(name); if (StringUtil.isEmpty(personalID)) { personalID = RandomStringUtils.randomNumeric(10); } fakeCompany.setPersonalID(personalID); if (lastChanged == null) lastChanged = new java.sql.Date(System.currentTimeMillis()); fakeCompany.setLastChange(lastChanged); if (StringUtil.isEmpty(operationForm)) operationForm = RandomStringUtils.random(20, TestConstants.setOfChars); // TODO fakeCompany.setOperationForm(operationForm) if (StringUtil.isEmpty(vatNumber)) vatNumber = RandomStringUtils.randomNumeric(10); fakeCompany.setVATNumber(vatNumber); if (StringUtil.isEmpty(legalAddress)) legalAddress = RandomStringUtils.random(20, TestConstants.setOfChars); // TODO fakeCompany.setLegalCommune(legalCommune) if (registrationDate == null) registrationDate = new java.sql.Date(System.currentTimeMillis() - (RandomUtils.nextInt() % 10000)); fakeCompany.setRegisterDate(registrationDate); if (StringUtil.isEmpty(operation)) operation = RandomStringUtils.random(20, TestConstants.setOfChars); fakeCompany.setOperation(operation); if (StringUtil.isEmpty(recipientPersonalId)) recipientPersonalId = RandomStringUtils.randomNumeric(10); fakeCompany.setRecipientId(recipientPersonalId); if (StringUtil.isEmpty(recipientName)) recipientName = RandomStringUtils.random(20, TestConstants.setOfChars); fakeCompany.setRecipientName(recipientName); if (StringUtil.isEmpty(industryCode)) industryCode = RandomStringUtils.randomNumeric(10); // TODO fakeCompany.setIndustryCode(industryCode) if (StringUtil.isEmpty(unregistrationType)) unregistrationType = RandomStringUtils.random(20, TestConstants.setOfChars); // TODO fakeCompany.setUnregisterType(unregisterType) if (unregistrationDate == null) unregistrationDate = new java.sql.Date(System.currentTimeMillis() - (RandomUtils.nextInt() % 10000)); fakeCompany.setUnregisterDate(unregistrationDate); if (StringUtil.isEmpty(banMarking)) banMarking = RandomStringUtils.randomNumeric(10); fakeCompany.setBanMarking(banMarking); fakeCompany.setOpen(RandomUtils.nextBoolean()); try { fakeCompany.store(); } catch (IDOStoreException e) { getLogger().log(Level.WARNING, "Unable to create fake: " + Company.class, e); return null; } try { Phone phone = getUserBusiness().getPhoneHome().create(); phone.setPhoneTypeId(PhoneTypeBMPBean.HOME_PHONE_ID); phone.setNumber(RandomStringUtils.randomNumeric(7)); fakeCompany.updatePhone(phone); } catch (Exception e) { e.printStackTrace(); } try { Phone fax = getUserBusiness().getPhoneHome().create(); fax.setPhoneTypeId(PhoneTypeBMPBean.FAX_NUMBER_ID); fax.setNumber(RandomStringUtils.randomNumeric(7)); fakeCompany.updateFax(fax); } catch (Exception e) { e.printStackTrace(); } try { Email email = getUserBusiness().getEmailHome().create(); email.setEmailAddress(RandomStringUtils.random(20, TestConstants.setOfChars) + "@idega.is"); fakeCompany.updateEmail(email); } catch (Exception e) { e.printStackTrace(); } try { fakeCompany.store(); } catch (IDOStoreException e) { getLogger().log(Level.WARNING, "Unable to create fake: " + Company.class, e); return null; } return fakeCompany; }