List of usage examples for org.springframework.dao DataRetrievalFailureException DataRetrievalFailureException
public DataRetrievalFailureException(String msg)
From source file:org.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache.java
public CasAuthenticationToken getByTicketId(String serviceTicket) { Element element = null;/* ww w . j a v a2s .c om*/ try { element = cache.get(serviceTicket); } catch (CacheException cacheException) { throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage()); } if (logger.isDebugEnabled()) { logger.debug("Cache hit: " + (element != null) + "; service ticket: " + serviceTicket); } if (element == null) { return null; } else { return (CasAuthenticationToken) element.getValue(); } }
From source file:org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache.java
public UserDetails getUserFromCache(String username) { Element element = null;//from ww w . ja v a 2 s . com try { element = cache.get(username); } catch (CacheException cacheException) { throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage()); } if (logger.isDebugEnabled()) { logger.debug("Cache hit: " + (element != null) + "; username: " + username); } if (element == null) { return null; } else { return (UserDetails) element.getValue(); } }
From source file:org.acegisecurity.providers.x509.cache.EhCacheBasedX509UserCache.java
public UserDetails getUserFromCache(X509Certificate userCert) { Element element = null;/* w w w .ja v a2s. c o m*/ try { element = cache.get(userCert); } catch (CacheException cacheException) { throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage()); } if (logger.isDebugEnabled()) { String subjectDN = "unknown"; if ((userCert != null) && (userCert.getSubjectDN() != null)) { subjectDN = userCert.getSubjectDN().toString(); } logger.debug("X.509 Cache hit. SubjectDN: " + subjectDN); } if (element == null) { return null; } else { return (UserDetails) element.getValue(); } }
From source file:org.apereo.portal.portlet.dao.jpa.JpaPortletEntityDao.java
@Override @PortalTransactional// w ww. j a v a2s . co m public IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId, String layoutNodeId, int userId) { Validate.notNull(portletDefinitionId, "portletDefinitionId can not be null"); Validate.notEmpty(layoutNodeId, "layoutNodeId can not be null"); final IPortletDefinition portletDefinition = this.portletDefinitionDao .getPortletDefinition(portletDefinitionId); if (portletDefinition == null) { throw new DataRetrievalFailureException( "No IPortletDefinition exists for IPortletDefinitionId='" + portletDefinitionId + "'"); } IPortletEntity portletEntity = new PortletEntityImpl(portletDefinition, layoutNodeId, userId); this.getEntityManager().persist(portletEntity); return portletEntity; }
From source file:org.beangle.security.cas.auth.EhCacheTicketCache.java
public CasAuthentication get(String serviceTicket) { Element element = null;//from w ww . j ava 2 s .c o m try { element = cache.get(serviceTicket); } catch (CacheException cacheException) { throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage()); } if (logger.isDebugEnabled()) { logger.debug("Cache hit: " + (element != null) + "; service ticket: " + serviceTicket); } if (element == null) { return null; } else { return (CasAuthentication) element.getValue(); } }
From source file:org.opennms.netmgt.ticketer.centric.CentricTicketerPlugin.java
/** * Implementation of TicketerPlugin API call to retrieve a CentricCRM trouble ticket. * @return an OpenNMS /*from w w w . j a v a 2 s . co m*/ */ public Ticket get(String ticketId) { CentricConnection crm = createConnection(); ArrayList<String> returnFields = new ArrayList<String>(); returnFields.add("id"); returnFields.add("modified"); returnFields.add("problem"); returnFields.add("comment"); returnFields.add("stateId"); crm.setTransactionMeta(returnFields); DataRecord query = new DataRecord(); query.setName("ticketList"); query.setAction(DataRecord.SELECT); query.addField("id", ticketId); boolean success = crm.load(query); if (!success) { throw new DataRetrievalFailureException(crm.getLastResponse()); } Ticket ticket = new Ticket(); ticket.setId(crm.getResponseValue("id")); ticket.setModificationTimestamp(crm.getResponseValue("modified")); ticket.setSummary(crm.getResponseValue("problem")); ticket.setDetails(crm.getResponseValue("comment")); ticket.setState(getStateFromId(crm.getResponseValue("stateId"))); return ticket; }
From source file:org.opennms.netmgt.ticketer.centric.CentricTicketerPlugin.java
public void saveOrUpdate(Ticket ticket) { CentricConnection crm = createConnection(); ArrayList<String> returnFields = new ArrayList<String>(); returnFields.add("id"); crm.setTransactionMeta(returnFields); DataRecord record = createDataRecord(); record.setName("ticket"); if (ticket.getId() == null) { record.setAction(DataRecord.INSERT); } else {//from w w w .j a va 2 s .co m record.setAction(DataRecord.UPDATE); record.addField("id", ticket.getId()); record.addField("modified", ticket.getModificationTimestamp()); } record.addField("problem", ticket.getSummary()); record.addField("comment", ticket.getDetails()); record.addField("stateId", getStateId(ticket.getState())); record.addField("closeNow", isClosingState(ticket.getState())); crm.save(record); boolean success = crm.commit(); if (!success) { throw new DataRetrievalFailureException("Failed to commit Centric transaction: " + crm.getErrorText()); } Assert.isTrue(1 == crm.getRecordCount(), "Unexpected record count from CRM"); String id = crm.getResponseValue("id"); ticket.setId(id); /* <map class="org.aspcfs.modules.troubletickets.base.Ticket" id="ticket"> <property alias="guid">id</property> <property lookup="account">orgId</property> <property lookup="contact">contactId</property> <property>problem</property> <property>entered</property> <property lookup="user">enteredBy</property> <property>modified</property> <property lookup="user">modifiedBy</property> <property>closed</property> <property lookup="ticketPriority">priorityCode</property> <property>levelCode</property> <property lookup="lookupDepartment">departmentCode</property> <property lookup="lookupTicketSource">sourceCode</property> <property lookup="ticketCategory">catCode</property> <property lookup="ticketCategory">subCat1</property> <property lookup="ticketCategory">subCat2</property> <property lookup="ticketCategory">subCat3</property> <property lookup="user">assignedTo</property> <property>comment</property> <property>solution</property> <property lookup="ticketSeverity">severityCode</property> <!-- REMOVE: critical --> <!-- REMOVE: notified --> <!-- REMOVE: custom_data --> <property>location</property> <property>assignedDate</property> <property>estimatedResolutionDate</property> <property>resolutionDate</property> <property>cause</property> <property>contractId</property> <property>assetId</property> <property>productId</property> <property>customerProductId</property> <property>expectation</property> <property>projectTicketCount</property> <property>estimatedResolutionDateTimeZone</property> <property>assignedDateTimeZone</property> <property>resolutionDateTimeZone</property> <property>statusId</property> <property>trashedDate</property> <property>userGroupId</property> <property>causeId</property> <property>resolutionId</property> <property>defectId</property> <property>escalationLevel</property> <property>resolvable</property> <property>resolvedBy</property> <property>resolvedByDeptCode</property> <property>stateId</property> <property>siteId</property> </map> */ }
From source file:org.springframework.autobuilds.ejbtest.hibernate.tx.ejb.CmtJtaNoSpringTxEJB.java
public void throwExceptionSoSessionUnbindCanBeVerified() throws DataAccessException { HibernateTemplate h = new HibernateTemplate(sessionFactory, true); h.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { return session; }//from w w w. j a v a2 s . c om }); h.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { throw new DataRetrievalFailureException( "This Exception is being thrown just to verify proper unbinding of Hibernate Session from JTA transaction"); } }); }