@SuppressWarnings("unchecked") @Override public BusinessServicesSerializer<?> getSerializerOfType(String type) { BusinessServicesSerializer<?> serializer = serializers.get(type); if (serializer == null) { throw new GeneralBusinessException("Serializer of type {} not found.", type); } return serializer; }
@Override public SearchHandler resolve(SearchViewConfiguration searchConfiguration) { SearchHandler handler = builderViewHandlers.get(searchConfiguration); if (handler == null){ throw new GeneralBusinessException("Unknown search type {}", searchConfiguration); } return handler; }
@Override public InterlocutorSendingPolicy getSendingPolicyForInterlocutorType(InterlocutorType interType) { InterlocutorSendingPolicy sendingPolicy = sendingPolicies.get(interType); if (sendingPolicy == null) { throw new GeneralBusinessException("Sending policy for interlocutor of type {} not found.", interType); } return sendingPolicy; }
@SuppressWarnings("unchecked") @Override public PortalSerializer<?> getSerializerOfType(String type) { PortalSerializer<?> serializer = serializers.get(type); if (serializer == null) { throw new GeneralBusinessException("Serializer of type {} not found.", type); } return serializer; }
private ProjectCategoryPair getPairByCategoryId(final String portalCategoryId) { ProjectCategoryPair projectCategoryPair = categoryMap.get(portalCategoryId); if (projectCategoryPair == null) { throw new GeneralBusinessException("Category {} does not exists in configuration", portalCategoryId); } return projectCategoryPair; }
@Override public ServiceDeployment retrieveServiceDeployment(HttpServletRequest request) { String jsonDeployment = request.getParameter("serviceDeployment"); ServiceDeployment result = null; try { result = objectMapper.readValue(jsonDeployment, ServiceDeployment.class); } catch (IOException e) { throw new GeneralBusinessException(e); } return result; }
@Override public Object transform(ServiceDeployment serviceDeployment) { StringWriter sw = new StringWriter(); try { objectMapper.writeValue(sw, serviceDeployment); } catch (IOException e) { throw new GeneralBusinessException(e); } return sw.toString(); }
@RequestMapping(value="cas/{ticketGrantingTicket}") @ResponseBody public String getServiceTicket(final HttpServletRequest request, final HttpServletResponse response, @PathVariable("ticketGrantingTicket") final String ticketGrantingTicket) { String username = ticketGrantingTickets.get(ticketGrantingTicket); if (username == null) { throw new GeneralBusinessException("Not found ticketGrantingTicket: ", ticketGrantingTicket); } String serviceTicket = UUID.randomUUID().toString(); serviceTickets.put(serviceTicket, username); logger.debug("Ticket granting ticket '{}' generate service ticket '{}'", ticketGrantingTicket, serviceTicket); return serviceTicket; }
@Override public T apply(Set<DBUserProfileCustomProperty> input) { if(input.size()>1) { throw new GeneralBusinessException("Too many parameters for single property"); } if(input.isEmpty()) { return null; } DBUserProfileCustomProperty property = input.iterator().next(); return doApply(property); }
public Properties getProperties() { try { return mergeProperties(); } catch (IOException e) { throw new GeneralBusinessException(e); } }
private List<String> pickObviousServices(boolean forceChoosing, Map<String, List<String>> serviceOptionMap) { List<String> pickedServices = new LinkedList<String>(); for (Map.Entry<String, List<String>> servicesEntries : serviceOptionMap.entrySet()) { if (servicesEntries.getValue().size() == 0) { throw new GeneralBusinessException("No deployed service with type {}", servicesEntries.getKey()); } else if (!forceChoosing && servicesEntries.getValue().size() == 1) { serviceChooser.setService(servicesEntries.getKey(), servicesEntries.getValue().get(0)); pickedServices.add(servicesEntries.getKey()); } } return pickedServices; }
private SearchHandler getSearchHandler(String searchConfiguration) { final SearchViewConfiguration searchConf = SearchViewConfiguration.fromCode(searchConfiguration); SearchHandler handler = advancedSearchBuilderViewHandlers.get(searchConf); if (handler == null) throw new GeneralBusinessException("Unsupported advanced search type {}", searchConfiguration); return handler; }
@Override public synchronized void removeService(final String serviceId) { ServiceDeployment removed = currentConfigurationMap.remove(serviceId); if (removed == null) { throw new GeneralBusinessException("Unable to remove service [{}]", serviceId); } saveConfiguration(); }
private String formatUrl(String url, ObservationObjectType objectType, String viewDescription, Object... params) { if (url == null) { throw new GeneralBusinessException( "Cannot determine '{}' for observation object type '{}'", objectType.name(), viewDescription); } return String.format(url, params); }
public void addProperties(Properties properties) { try { loadProperties(properties); } catch (IOException e) { throw new GeneralBusinessException(e); } } }
private ReferenceParser getParser(String referenceText, final String format, final String filename) { for (ReferenceParser parser : parsers) { if (parser.isAplicable(referenceText, format, filename)) { return parser; } } throw new GeneralBusinessException("should never be here"); }
private DocumentAttachment prepareDocumentAttachment(final String originalId, final byte[] data) throws IOException { try { return new DocumentAttachment(originalId, RepositoryStoreConstants.PATH_PREFIX_METADATA + RepositoryStoreConstants.PATH_SEPARATOR, null, data.length, // XML/TEXT SpeechToTextImporterConstants.XML_TYPE, data, true); } catch (Exception e) { logger.error(COULDN_T_PARSE + originalId, e); throw new GeneralBusinessException(e, COULDN_T_PARSE + originalId); } }
private void contentPart(String elementId, String actionType, boolean viewOnline, Model model, HttpServletRequest request , HttpServletResponse response) { String prefix = "/resource/" + elementId + "/content/" + actionType + "/"; String pathInfo = request.getServletPath(); int prefixIndex = pathInfo.indexOf(prefix); String partId; if (prefixIndex == -1) { throw new GeneralBusinessException("Error while parsing url {} ", pathInfo); } else { partId = pathInfo.substring(prefixIndex + prefix.length()); } contentPart(elementId, actionType, viewOnline, model, request, response, partId); }
protected void log(FulltextSearchQuery searchQuery) { try { // Only debug if(log.isDebugEnabled()){ String r = new XStream().toXML(searchQuery); log.debug("prepareSearchCountAndDataModel(" + currentTime() + ") query:"); log.debug(r); } // End } catch (Exception e) { throw new GeneralBusinessException(e); } }
private YElement prepareYElement(List<Video> videosList) { YElement yElement = new YElement(); if (videosList != null) { Video video = videosList.get(FIRST); try { prepareYElementFromApi(video, yElement); } catch(ParseException e) { throw new GeneralBusinessException(e); } } return yElement; }