List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:de.hybris.platform.secureportaladdon.cockpit.config.impl.TaskCellRenderer.java
/** * Displays a notification to the user with the provided message. * // w w w . j a v a2 s .co m * @param model * The table model * @param message * The message that we display to the user * @param parent * The parent control of this renderer */ protected void showNotification(final TableModel model, final Component parent, final String message) { final Notification notification = new Notification(message); model.fireEvent("shownotification", notification); UISessionUtils.getCurrentSession() .sendGlobalEvent(new ItemChangedEvent(parent, null, Collections.EMPTY_LIST)); }
From source file:sdmx.net.service.sdw.Sdmx20SOAPQueryable.java
public List<DataflowType> listDataflows() { if (dataflowList != null) { return dataflowList; }//from www .ja va 2 s. c o m dataflowList = new ArrayList<DataflowType>(); StructureType st = null; String s = QueryToSdmx20Query.toGetDataStructureListQuery(this.agencyId, soapNamespace); if (SdmxIO.isDumpQuery()) { System.out.println(s); } byte[] b = s.getBytes(); InputStream in = new ByteArrayInputStream(b); try { st = SdmxIO.parseStructure(query("GetDataStructureDefinitionResult", in, b.length)); } catch (IOException ex) { Logger.getLogger(Sdmx20SOAPQueryable.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } catch (ParseException ex) { Logger.getLogger(Sdmx20SOAPQueryable.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } if (st == null) { dataflowList = null; return Collections.EMPTY_LIST; } Iterator<DataStructureType> it = st.getStructures().getDataStructures().getDataStructures().iterator(); while (it.hasNext()) { DataStructureType ds = it.next(); DataflowType flow = new DataflowType(); flow.setAgencyID(ds.getAgencyID()); flow.setId(ds.getId()); flow.setVersion(ds.getVersion()); flow.setNames(ds.getNames()); flow.setDescriptions(ds.getDescriptions()); flow.setStructure(ds.asReference()); flow.setAnnotations(ds.getAnnotations()); dataflowList.add(flow); } return dataflowList; }
From source file:pe.gob.mef.gescon.web.ui.ParametroMB.java
public void save(ActionEvent event) { try {/*from w w w . jav a 2s .com*/ if (CollectionUtils.isEmpty(this.getListaParametro())) { this.setListaParametro(Collections.EMPTY_LIST); } Parametro parametro = new Parametro(); parametro.setVnombre(this.getNombre()); parametro.setVvalor(this.getValor()); parametro.setVdescripcion(this.getDescripcion()); if (!errorValidation(parametro)) { LoginMB loginMB = (LoginMB) JSFUtils.getSessionAttribute("loginMB"); User user = loginMB.getUser(); ParametroService service = (ParametroService) ServiceFinder.findBean("ParametroService"); parametro.setNparametroid(service.getNextPK()); parametro.setVnombre(StringUtils.upperCase(this.getNombre().trim())); parametro.setVvalor(this.getValor()); parametro.setVdescripcion(StringUtils.capitalize(this.getDescripcion().trim())); parametro.setNactivo(BigDecimal.ONE); parametro.setDfechacreacion(new Date()); parametro.setVusuariocreacion(user.getVlogin()); service.saveOrUpdate(parametro); this.setListaParametro(service.getParametros()); this.cleanAttributes(); RequestContext.getCurrentInstance().execute("PF('newDialog').hide();"); } } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); } }
From source file:org.openmrs.module.patientaccesscontrol.api.impl.RoleProgramServiceImpl.java
@SuppressWarnings("unchecked") @Override/*from www . ja va 2s. co m*/ @Transactional(readOnly = true) public List<Integer> getIncludedPatients() { if (canViewPatientsNotInPrograms()) { return null; } return dao.getIncludedPatients(null, null, Collections.EMPTY_LIST, false, getPrograms()); }
From source file:com.inkwell.internet.productregistration.registration.portlet.ProductAdminPortlet.java
/** * Gets all the registrations and puts them in the request. * * @param request//from w w w . ja v a2 s .com * @param response * @throws PortletException * @throws IOException */ public void editDisplayRegistrations(ActionRequest request, ActionResponse response) throws PortletException, IOException { List<PRRegistration> tempResults = Collections.EMPTY_LIST; ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long groupId = themeDisplay.getLayout().getGroupId(); try { tempResults = PRRegistrationLocalServiceUtil.getAllRegistrations(groupId); } catch (SystemException ex) { _log.debug(ex); } request.setAttribute("registrations", tempResults); response.setRenderParameter("jspPage", displayRegistrationsJSP); }
From source file:com.nextep.datadesigner.dbgm.services.DBGMHelper.java
/** * This method is a helper which retrieves all foreign keys which are * currently enforced by the specified index. TODO: handle backup indexes * which would still enforce the constraint after an enforcing index removal * //w ww . j av a2s. co m * @param index * index which may enforce a foreign key constraint * @return foreign keys enforced by the specified index */ @SuppressWarnings("unchecked") public static Collection<ForeignKeyConstraint> getForeignKeysForIndex(IIndex index) { if (index == null) return Collections.EMPTY_LIST; IBasicTable t = index.getIndexedTable(); List<ForeignKeyConstraint> fkeys = new ArrayList<ForeignKeyConstraint>(); for (IKeyConstraint c : t.getConstraints()) { if (c.getConstraintType() == ConstraintType.FOREIGN) { ForeignKeyConstraint fk = (ForeignKeyConstraint) c; // If we have several enforcing index / constraints for this FK, // the index is not // the enforcing one (i.e. it could be removed without any // problem) so we only // consider the case of FK having one unique enforcing index / // constraint if (fk.getEnforcingIndex().size() == 1) { final IDatabaseRawObject enforcingIndex = fk.getEnforcingIndex().iterator().next(); // We need to be compatible with volatiles so we check // reference ids if (enforcingIndex == index) { fkeys.add(fk); } else if (enforcingIndex != null && enforcingIndex.getReference() != null && enforcingIndex.getReference().equals(index.getReference())) { fkeys.add(fk); } else if (enforcingIndex != null && enforcingIndex.getReference().getUID() != null && enforcingIndex.getReference().getUID().equals(index.getReference().getUID())) { fkeys.add(fk); } } } } return fkeys; }
From source file:org.jfree.data.statistics.DefaultMultiValueCategoryDataset.java
/** * Returns a list (possibly empty) of the values for the specified item. * The returned list should be unmodifiable. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The list of values.// w w w. j a v a 2s.co m */ @Override public List getValues(int row, int column) { List values = (List) this.data.getObject(row, column); if (values != null) { return Collections.unmodifiableList(values); } else { return Collections.EMPTY_LIST; } }
From source file:fi.vm.sade.organisaatio.business.impl.OrganisaatioTarjonta.java
private List<KoulutusHakutulosV1RDTO> haeKoulutukset(String oid) { List<KoulutusHakutulosV1RDTO> koulutukset = new ArrayList<>(); InputStream jsonStream;//from ww w .j a va 2 s . c o m String url = tarjontaServiceWebappUrl + "/v1" + buildSearchKoulutusUri(oid); try { jsonStream = restToStream.getInputStreamFromUri(url); } catch (RuntimeException e) { LOG.warn("Search failed for koulutus with organization oid: " + oid); throw new OrganisaatioTarjontaException(); } Reader reader = new InputStreamReader(jsonStream); JsonElement json = new JsonParser().parse(reader); // Tarkistetaan hakutulokset if (json.getAsJsonObject().get("status").isJsonNull()) { LOG.warn("Search failed for koulutus with organization oid: " + oid); throw new OrganisaatioTarjontaException(); } ResultStatus status = gson.fromJson(json.getAsJsonObject().get("status"), new TypeToken<ResultStatus>() { }.getType()); if (status != ResultStatus.OK) { LOG.warn("Search failed for koulutus with organization oid: " + oid + " status: " + status); throw new OrganisaatioTarjontaException(); } // Otetaan ensimminen taso "result" JsonElement result = json.getAsJsonObject().get("result"); if (result.isJsonNull()) { LOG.warn("Search failed for koulutus with organization oid: " + oid + " --> result == NULL"); return Collections.EMPTY_LIST; } // Otetaan organisaatiolista (sislt listata organisaatioiden hakutuloksista) JsonElement organisaatioTulokset = result.getAsJsonObject().get("tulokset"); if (organisaatioTulokset.isJsonNull()) { LOG.warn("Search failed for koulutus with organization oid: " + oid + " --> tulokset == NULL"); return Collections.EMPTY_LIST; } // Kydn lpi organisaatioiden koulutukset ja listn listalle JsonArray organisaatioTuloksetArray = organisaatioTulokset.getAsJsonArray(); for (JsonElement organisaatioTulos : organisaatioTuloksetArray) { koulutukset.addAll(getOrganisaatioKoulutukset(organisaatioTulos)); } return koulutukset; }
From source file:org.alfresco.bm.invokewebscript.InvokeWebScriptEventProcessor.java
@Override public EventResult processEvent(Event event) throws Exception { // Usually, the entire method is timed but we can choose to control this super.suspendTimer(); // Get the Web Script Invocation name String webScriptInvocationName = (String) event.getData(); // Locate the Web Script Invocation data and make a quick check on it WebScriptInvocationData webScriptInvocationData = webScriptInvocationDataDAO .findWebScriptInvocationByName(webScriptInvocationName); EventResult result = null;//from w ww .j a va 2 s.com if (webScriptInvocationData == null) { result = new EventResult("Skipping processing for '" + webScriptInvocationName + "'. Web Script Invocation data not found.", false); return result; } else if (webScriptInvocationData.getState() != DataCreationState.Scheduled) { result = new EventResult("Skipping processing for '" + webScriptInvocationName + "'. Web Script Invocation not scheduled.", false); return result; } else if (webScriptInvocationData.getUsername() == null) { result = new EventResult("Skipping processing for '" + webScriptInvocationName + "'. Web Script Invocation has no username.", false); return result; } else if (webScriptInvocationData.getMessage() == null) { result = new EventResult("Skipping processing for '" + webScriptInvocationName + "'. Web Script Invocation has no message.", false); return result; } EventResult eventResult = null; // Look up the user data for the username that will be used to authenticate and invoke the Web Script UserData user = userDataService.findUserByUsername(webScriptInvocationData.getUsername()); if (user == null) { eventResult = new EventResult( "User data not found in local database: " + webScriptInvocationData.getUsername(), Collections.EMPTY_LIST, false); return eventResult; } // Start the clock that times the Web Script call resumeTimer(); // Make the Web Script call authenticated as username // WebScript Call will have a URL looking something like: // http://localhost:8080/alfresco/service/sample/helloworld?message=Message%200000003 HttpGet webScriptInvocationGet = new HttpGet(getFullUrlForPath( HELLO_WORLD_WS_URL + URLEncoder.encode(webScriptInvocationData.getMessage(), "UTF-8"))); HttpResponse httpResponse = executeHttpMethodAsUser(webScriptInvocationGet, webScriptInvocationData.getUsername(), SimpleHttpRequestCallback.getInstance()); StatusLine httpStatus = httpResponse.getStatusLine(); // Stop the clock, we are done with the Web Script call suspendTimer(); // Check if the Alfresco server responded with OK if (httpStatus.getStatusCode() == HttpStatus.SC_OK) { // Record the name of the Web Script Invocation to reflect that is was executed on the Alfresco server boolean updated = webScriptInvocationDataDAO.updateWebScriptInvacationState(webScriptInvocationName, DataCreationState.Created); if (updated) { // Create 'done' event, which will not have any further associated event processors Event doneEvent = new Event(eventNameWebScriptInvocationDone, 0L, webScriptInvocationName); eventResult = new EventResult("Web Script Invocation " + webScriptInvocationName + " completed.", doneEvent); } else { throw new RuntimeException( "Web Script Invocation " + webScriptInvocationName + " was executed but not recorded."); } } else { // Web Script Invocation failed String msg = String.format("Web Script call failed, ReST-call resulted in status:%d with error %s ", httpStatus.getStatusCode(), httpStatus.getReasonPhrase()); eventResult = new EventResult(msg, Collections.<Event>emptyList(), false); webScriptInvocationDataDAO.updateWebScriptInvacationState(webScriptInvocationName, DataCreationState.Failed); } return eventResult; }
From source file:ch.mobi.itc.mobiliar.rest.resources.ResourcesRest.java
@GET @ApiOperation(value = "Get get resource groups", notes = "Returns the available resource groups") public List<ResourceGroupDTO> getResources( @ApiParam(value = "a resource type, the list should be filtered by") @QueryParam("type") String type) { List<ResourceGroupDTO> result = new ArrayList<>(); List<ResourceGroupEntity> resourceGroups; // used by angular if (type != null) { // TODO my favorites only resourceGroups = resourceGroupLocator.getGroupsForType(type, Collections.EMPTY_LIST, true, true); } else {/*from ww w. j a v a2 s . c o m*/ resourceGroups = resourceGroupLocator.getResourceGroups(); } for (ResourceGroupEntity resourceGroup : resourceGroups) { List<ReleaseEntity> releases = new ArrayList<>(); for (ResourceEntity resource : resourceGroup.getResources()) { releases.add(resource.getRelease()); } result.add(new ResourceGroupDTO(resourceGroup, releases)); } return result; }