List of usage examples for org.apache.commons.collections4 CollectionUtils isNotEmpty
public static boolean isNotEmpty(final Collection<?> coll)
From source file:com.jkoolcloud.tnt4j.streams.fields.ActivityInfo.java
/** * Builds {@link TrackingActivity} for activity data recording. * // w w w . ja va 2 s.c o m * @param tracker * communication gateway to use to record activity * @param trackName * name of tracking activity * @param trackId * identifier (signature) of tracking activity * @param chTrackables * collection to add built child trackables, not included into parent activity and transmitted separately * @return tracking activity instance */ private TrackingActivity buildActivity(Tracker tracker, String trackName, String trackId, Collection<Trackable> chTrackables) { TrackingActivity activity = tracker.newActivity(severity == null ? OpLevel.INFO : severity, trackName); activity.setTrackingId(trackId); activity.setParentId(parentId); // activity.setCorrelator(CollectionUtils.isEmpty(correlator) ? Collections.singletonList(trackId) : // correlator); if (CollectionUtils.isNotEmpty(correlator)) { activity.setCorrelator(correlator); } if (CollectionUtils.isNotEmpty(tag)) { addActivityProperty(JSONFormatter.JSON_MSG_TAG_FIELD, tag); } if (message != null) { String strData; if (message instanceof byte[]) { byte[] binData = (byte[]) message; strData = Utils.base64EncodeStr(binData); msgEncoding = "base64"; // NON-NLS msgMimeType = "application/octet-stream"; // NON-NLS } else { strData = Utils.toString(message); } addActivityProperty(JSONFormatter.JSON_MSG_TEXT_FIELD, strData); addActivityProperty(JSONFormatter.JSON_MSG_SIZE_FIELD, msgLength == null ? strData.length() : msgLength); } if (StringUtils.isNotEmpty(msgMimeType)) { addActivityProperty(JSONFormatter.JSON_MSG_MIME_FIELD, msgMimeType); } if (StringUtils.isNotEmpty(msgEncoding)) { addActivityProperty(JSONFormatter.JSON_MSG_ENC_FIELD, msgEncoding); } if (StringUtils.isNotEmpty(msgCharSet)) { addActivityProperty(JSONFormatter.JSON_MSG_CHARSET_FIELD, msgCharSet); } activity.setCompCode(compCode == null ? OpCompCode.SUCCESS : compCode); activity.setReasonCode(reasonCode); activity.setType(eventType); activity.setStatus(StringUtils.isNotEmpty(exception) ? ActivityStatus.EXCEPTION : eventStatus == null ? ActivityStatus.END : eventStatus); activity.setException(exception); if (StringUtils.isNotEmpty(location)) { activity.setLocation(location); } activity.setResource(resourceName); activity.setUser(StringUtils.isEmpty(userName) ? tracker.getSource().getUser() : userName); activity.setTID(threadId == null ? Thread.currentThread().getId() : threadId); activity.setPID(processId == null ? Utils.getVMPID() : processId); // activity.setSeverity(severity == null ? OpLevel.INFO : severity); activity.start(startTime); activity.stop(endTime, elapsedTime); if (activityProperties != null) { for (Property ap : activityProperties.values()) { if (isNotTransparentProperty(ap)) { if (ap.getValue() instanceof Trackable) { activity.add((Trackable) ap.getValue()); } else { activity.addProperty(ap); } } } } if (hasChildren()) { for (ActivityInfo child : children) { Trackable cTrackable = buildChild(tracker, child, trackId); boolean consumed = addTrackableChild(activity, cTrackable); if (!consumed && chTrackables != null) { chTrackables.add(cTrackable); } } } return activity; }
From source file:io.github.swagger2markup.internal.document.builder.PathsDocumentBuilder.java
/** * Builds inline schema definitions/* w ww . j av a 2s.c o m*/ * * @param definitions all inline definitions to display * @param uniquePrefix unique prefix to prepend to inline object names to enforce unicity * @param docBuilder the docbuilder do use for output */ private void inlineDefinitions(List<ObjectType> definitions, String uniquePrefix, MarkupDocBuilder docBuilder) { if (CollectionUtils.isNotEmpty(definitions)) { for (ObjectType definition : definitions) { addInlineDefinitionTitle(definition.getName(), definition.getUniqueName(), docBuilder); List<ObjectType> localDefinitions = buildPropertiesTable(definition.getProperties(), uniquePrefix, new DefinitionDocumentResolverFromOperation(), docBuilder); for (ObjectType localDefinition : localDefinitions) inlineDefinitions(Collections.singletonList(localDefinition), localDefinition.getUniqueName(), docBuilder); } } }
From source file:com.jkoolcloud.tnt4j.streams.fields.ActivityInfo.java
/** * Builds {@link Snapshot} for activity data recording. * * @param tracker/*from ww w . j a va 2 s.co m*/ * communication gateway to use to record snapshot * @param trackName * name of snapshot * @param trackId * identifier (signature) of snapshot * @return snapshot instance */ protected Snapshot buildSnapshot(Tracker tracker, String trackName, String trackId) { PropertySnapshot snapshot = category != null ? (PropertySnapshot) tracker.newSnapshot(category, trackName) : (PropertySnapshot) tracker.newSnapshot(trackName); snapshot.setTrackingId(trackId); snapshot.setParentId(parentId); snapshot.setSeverity(severity == null ? OpLevel.INFO : severity); // snapshot.setCorrelator(CollectionUtils.isEmpty(correlator) ? Collections.singletonList(trackId) : // correlator); if (CollectionUtils.isNotEmpty(correlator)) { snapshot.setCorrelator(correlator); } if (CollectionUtils.isNotEmpty(tag)) { snapshot.add(JSONFormatter.JSON_MSG_TAG_FIELD, tag); } if (message != null) { String strData; if (message instanceof byte[]) { byte[] binData = (byte[]) message; strData = Utils.base64EncodeStr(binData); msgEncoding = "base64"; // NON-NLS msgMimeType = "application/octet-stream"; // NON-NLS } else { strData = Utils.toString(message); } addActivityProperty(JSONFormatter.JSON_MSG_TEXT_FIELD, strData); addActivityProperty(JSONFormatter.JSON_MSG_SIZE_FIELD, msgLength == null ? strData.length() : msgLength); } if (StringUtils.isNotEmpty(msgMimeType)) { snapshot.add(JSONFormatter.JSON_MSG_MIME_FIELD, msgMimeType); } if (StringUtils.isNotEmpty(msgEncoding)) { snapshot.add(JSONFormatter.JSON_MSG_ENC_FIELD, msgEncoding); } if (StringUtils.isNotEmpty(msgCharSet)) { snapshot.add(JSONFormatter.JSON_MSG_CHARSET_FIELD, msgCharSet); } snapshot.add(JSONFormatter.JSON_COMP_CODE_FIELD, compCode == null ? OpCompCode.SUCCESS : compCode); snapshot.add(JSONFormatter.JSON_REASON_CODE_FIELD, reasonCode); snapshot.add(JSONFormatter.JSON_TYPE_FIELD, eventType); snapshot.add(JSONFormatter.JSON_EXCEPTION_FIELD, exception); if (StringUtils.isNotEmpty(location)) { snapshot.add(JSONFormatter.JSON_LOCATION_FIELD, location); } snapshot.add(JSONFormatter.JSON_RESOURCE_FIELD, resourceName); snapshot.add(JSONFormatter.JSON_USER_FIELD, StringUtils.isEmpty(userName) ? tracker.getSource().getUser() : userName); snapshot.add(JSONFormatter.JSON_TID_FIELD, threadId == null ? Thread.currentThread().getId() : threadId); snapshot.add(JSONFormatter.JSON_PID_FIELD, processId == null ? Utils.getVMPID() : processId); snapshot.setTimeStamp(startTime == null ? (endTime == null ? UsecTimestamp.now() : endTime) : startTime); if (eventStatus != null) { addActivityProperty(JSONFormatter.JSON_STATUS_FIELD, eventStatus); } if (activityProperties != null) { for (Property ap : activityProperties.values()) { if (isNotTransparentProperty(ap)) { snapshot.add(ap); } } } return snapshot; }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java
@Nullable @Override//from w w w .ja v a2 s .c o m public SortInfo getSortInfo() { // SortInfo is returned only for sorting triggered from UI List<? extends RowSorter.SortKey> sortKeys = impl.getRowSorter().getSortKeys(); if (CollectionUtils.isNotEmpty(sortKeys)) { RowSorter.SortKey sortKey = sortKeys.get(0); return new SortInfo(columnsOrder.get(sortKey.getColumn()).getId(), SortOrder.ASCENDING.equals(sortKey.getSortOrder())); } return null; }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
public void importGroup(ChannelGroup importGroup, boolean showAlerts, boolean synchronous) { // First consolidate and import code template libraries Map<String, CodeTemplateLibrary> codeTemplateLibraryMap = new LinkedHashMap<String, CodeTemplateLibrary>(); Set<String> codeTemplateIds = new HashSet<String>(); for (Channel channel : importGroup.getChannels()) { if (channel.getCodeTemplateLibraries() != null) { for (CodeTemplateLibrary library : channel.getCodeTemplateLibraries()) { CodeTemplateLibrary matchingLibrary = codeTemplateLibraryMap.get(library.getId()); if (matchingLibrary != null) { for (CodeTemplate codeTemplate : library.getCodeTemplates()) { if (codeTemplateIds.add(codeTemplate.getId())) { matchingLibrary.getCodeTemplates().add(codeTemplate); }/*ww w . java 2s . c om*/ } } else { matchingLibrary = library; codeTemplateLibraryMap.put(matchingLibrary.getId(), matchingLibrary); List<CodeTemplate> codeTemplates = new ArrayList<CodeTemplate>(); for (CodeTemplate codeTemplate : matchingLibrary.getCodeTemplates()) { if (codeTemplateIds.add(codeTemplate.getId())) { codeTemplates.add(codeTemplate); } } matchingLibrary.setCodeTemplates(codeTemplates); } // Combine the library enabled / disabled channel IDs matchingLibrary.getEnabledChannelIds().addAll(library.getEnabledChannelIds()); matchingLibrary.getEnabledChannelIds().add(channel.getId()); matchingLibrary.getDisabledChannelIds().addAll(library.getDisabledChannelIds()); matchingLibrary.getDisabledChannelIds().removeAll(matchingLibrary.getEnabledChannelIds()); } channel.getCodeTemplateLibraries().clear(); } } List<CodeTemplateLibrary> codeTemplateLibraries = new ArrayList<CodeTemplateLibrary>( codeTemplateLibraryMap.values()); parent.removeInvalidItems(codeTemplateLibraries, CodeTemplateLibrary.class); if (CollectionUtils.isNotEmpty(codeTemplateLibraries)) { boolean importLibraries; String importChannelCodeTemplateLibraries = Preferences.userNodeForPackage(Mirth.class) .get("importChannelCodeTemplateLibraries", null); if (importChannelCodeTemplateLibraries == null) { JCheckBox alwaysChooseCheckBox = new JCheckBox( "Always choose this option by default in the future (may be changed in the Administrator settings)"); Object[] params = new Object[] { "Group \"" + importGroup.getName() + "\" has code template libraries included with it. Would you like to import them?", alwaysChooseCheckBox }; int result = JOptionPane.showConfirmDialog(this, params, "Select an Option", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION || result == JOptionPane.NO_OPTION) { importLibraries = result == JOptionPane.YES_OPTION; if (alwaysChooseCheckBox.isSelected()) { Preferences.userNodeForPackage(Mirth.class).putBoolean("importChannelCodeTemplateLibraries", importLibraries); } } else { return; } } else { importLibraries = Boolean.parseBoolean(importChannelCodeTemplateLibraries); } if (importLibraries) { CodeTemplateImportDialog dialog = new CodeTemplateImportDialog(parent, codeTemplateLibraries, false, true); if (dialog.wasSaved()) { CodeTemplateLibrarySaveResult updateSummary = parent.codeTemplatePanel.attemptUpdate( dialog.getUpdatedLibraries(), new HashMap<String, CodeTemplateLibrary>(), dialog.getUpdatedCodeTemplates(), new HashMap<String, CodeTemplate>(), true, null, null); if (updateSummary == null || updateSummary.isOverrideNeeded() || !updateSummary.isLibrariesSuccess()) { return; } else { for (CodeTemplateUpdateResult result : updateSummary.getCodeTemplateResults().values()) { if (!result.isSuccess()) { return; } } } parent.codeTemplatePanel.doRefreshCodeTemplates(); } } } List<Channel> successfulChannels = new ArrayList<Channel>(); for (Channel channel : importGroup.getChannels()) { Channel importChannel = importChannel(channel, false, false); if (importChannel != null) { successfulChannels.add(importChannel); } } if (!StringUtils.equals(importGroup.getId(), ChannelGroup.DEFAULT_ID)) { ChannelTreeTableModel model = (ChannelTreeTableModel) channelTable.getTreeTableModel(); AbstractChannelTableNode importGroupNode = null; String groupName = importGroup.getName(); String tempId; try { tempId = parent.mirthClient.getGuid(); } catch (ClientException e) { tempId = UUID.randomUUID().toString(); } // Check to see that the channel name doesn't already exist. if (!checkGroupName(groupName)) { if (!parent.alertOption(parent, "Would you like to overwrite the existing group? Choose 'No' to create a new group.")) { importGroup.setRevision(0); do { groupName = JOptionPane.showInputDialog(this, "Please enter a new name for the group.", groupName); if (groupName == null) { return; } } while (!checkGroupName(groupName)); importGroup.setId(tempId); importGroup.setName(groupName); } else { MutableTreeTableNode root = (MutableTreeTableNode) model.getRoot(); for (Enumeration<? extends MutableTreeTableNode> groupNodes = root.children(); groupNodes .hasMoreElements();) { AbstractChannelTableNode groupNode = (AbstractChannelTableNode) groupNodes.nextElement(); if (StringUtils.equals(groupNode.getGroupStatus().getGroup().getName(), groupName)) { importGroupNode = groupNode; } } } } else { // Start the revision number over for a new channel group importGroup.setRevision(0); // If the channel name didn't already exist, make sure // the id doesn't exist either. if (!checkGroupId(importGroup.getId())) { importGroup.setId(tempId); } } Set<ChannelGroup> channelGroups = new HashSet<ChannelGroup>(); Set<String> removedChannelGroupIds = new HashSet<String>(groupStatuses.keySet()); removedChannelGroupIds.remove(ChannelGroup.DEFAULT_ID); MutableTreeTableNode root = (MutableTreeTableNode) channelTable.getTreeTableModel().getRoot(); if (root == null) { return; } for (Enumeration<? extends MutableTreeTableNode> groupNodes = root.children(); groupNodes .hasMoreElements();) { ChannelGroup group = ((AbstractChannelTableNode) groupNodes.nextElement()).getGroupStatus() .getGroup(); if (!StringUtils.equals(group.getId(), ChannelGroup.DEFAULT_ID)) { // If the current group is the one we're overwriting, merge the channels if (importGroupNode != null && StringUtils.equals(group.getId(), importGroupNode.getGroupStatus().getGroup().getId())) { group = importGroup; group.setRevision(importGroupNode.getGroupStatus().getGroup().getRevision()); Set<String> channelIds = new HashSet<String>(); for (Channel channel : group.getChannels()) { channelIds.add(channel.getId()); } // Add the imported channels for (Channel channel : successfulChannels) { channelIds.add(channel.getId()); } List<Channel> channels = new ArrayList<Channel>(); for (String channelId : channelIds) { channels.add(new Channel(channelId)); } group.setChannels(channels); } channelGroups.add(group); removedChannelGroupIds.remove(group.getId()); } } if (importGroupNode == null) { List<Channel> channels = new ArrayList<Channel>(); for (Channel channel : successfulChannels) { channels.add(new Channel(channel.getId())); } importGroup.setChannels(channels); channelGroups.add(importGroup); removedChannelGroupIds.remove(importGroup.getId()); } Set<String> channelIds = new HashSet<String>(); for (Channel channel : importGroup.getChannels()) { channelIds.add(channel.getId()); } for (ChannelGroup group : channelGroups) { if (group != importGroup) { for (Iterator<Channel> channels = group.getChannels().iterator(); channels.hasNext();) { if (!channelIds.add(channels.next().getId())) { channels.remove(); } } } } attemptUpdate(channelGroups, removedChannelGroupIds, false); } if (synchronous) { retrieveChannels(); updateModel(getCurrentTableState()); updateTasks(); parent.setSaveEnabled(false); } else { doRefreshChannels(); } }
From source file:com.jkoolcloud.tnt4j.streams.fields.ActivityInfo.java
/** * Checks whether this activity entity has any child activity entities added. * * @return {@code false} if children list is {@code null} or empty, {@code true} - otherwise *///from www.ja v a 2s . c o m public boolean hasChildren() { return CollectionUtils.isNotEmpty(children); }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
public Channel importChannel(Channel importChannel, boolean showAlerts, boolean refreshStatuses) { boolean overwrite = false; try {/*www . j a v a 2 s . c o m*/ String channelName = importChannel.getName(); String tempId = parent.mirthClient.getGuid(); // Check to see that the channel name doesn't already exist. if (!parent.checkChannelName(channelName, tempId)) { if (!parent.alertOption(parent, "Would you like to overwrite the existing channel? Choose 'No' to create a new channel.")) { importChannel.setRevision(0); do { channelName = JOptionPane.showInputDialog(this, "Please enter a new name for the channel.", channelName); if (channelName == null) { return null; } } while (!parent.checkChannelName(channelName, tempId)); importChannel.setName(channelName); setIdAndUpdateLibraries(importChannel, tempId); } else { overwrite = true; for (ChannelStatus channelStatus : channelStatuses.values()) { Channel channel = channelStatus.getChannel(); if (channel.getName().equalsIgnoreCase(channelName)) { // If overwriting, use the old revision number and id importChannel.setRevision(channel.getRevision()); setIdAndUpdateLibraries(importChannel, channel.getId()); } } } } else { // Start the revision number over for a new channel importChannel.setRevision(0); // If the channel name didn't already exist, make sure // the id doesn't exist either. if (!checkChannelId(importChannel.getId())) { setIdAndUpdateLibraries(importChannel, tempId); } } channelStatuses.put(importChannel.getId(), new ChannelStatus(importChannel)); parent.updateChannelTags(false); } catch (ClientException e) { parent.alertThrowable(parent, e); } // Import code templates / libraries if applicable parent.removeInvalidItems(importChannel.getCodeTemplateLibraries(), CodeTemplateLibrary.class); if (!(importChannel instanceof InvalidChannel) && !importChannel.getCodeTemplateLibraries().isEmpty()) { boolean importLibraries; String importChannelCodeTemplateLibraries = Preferences.userNodeForPackage(Mirth.class) .get("importChannelCodeTemplateLibraries", null); if (importChannelCodeTemplateLibraries == null) { JCheckBox alwaysChooseCheckBox = new JCheckBox( "Always choose this option by default in the future (may be changed in the Administrator settings)"); Object[] params = new Object[] { "Channel \"" + importChannel.getName() + "\" has code template libraries included with it. Would you like to import them?", alwaysChooseCheckBox }; int result = JOptionPane.showConfirmDialog(this, params, "Select an Option", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION || result == JOptionPane.NO_OPTION) { importLibraries = result == JOptionPane.YES_OPTION; if (alwaysChooseCheckBox.isSelected()) { Preferences.userNodeForPackage(Mirth.class).putBoolean("importChannelCodeTemplateLibraries", importLibraries); } } else { return null; } } else { importLibraries = Boolean.parseBoolean(importChannelCodeTemplateLibraries); } if (importLibraries) { CodeTemplateImportDialog dialog = new CodeTemplateImportDialog(parent, importChannel.getCodeTemplateLibraries(), false, true); if (dialog.wasSaved()) { CodeTemplateLibrarySaveResult updateSummary = parent.codeTemplatePanel.attemptUpdate( dialog.getUpdatedLibraries(), new HashMap<String, CodeTemplateLibrary>(), dialog.getUpdatedCodeTemplates(), new HashMap<String, CodeTemplate>(), true, null, null); if (updateSummary == null || updateSummary.isOverrideNeeded() || !updateSummary.isLibrariesSuccess()) { return null; } else { for (CodeTemplateUpdateResult result : updateSummary.getCodeTemplateResults().values()) { if (!result.isSuccess()) { return null; } } } parent.codeTemplatePanel.doRefreshCodeTemplates(); } } importChannel.getCodeTemplateLibraries().clear(); } if (CollectionUtils.isNotEmpty(importChannel.getDependentIds()) || CollectionUtils.isNotEmpty(importChannel.getDependencyIds())) { Set<ChannelDependency> channelDependencies = new HashSet<ChannelDependency>( getCachedChannelDependencies()); if (CollectionUtils.isNotEmpty(importChannel.getDependentIds())) { for (String dependentId : importChannel.getDependentIds()) { if (StringUtils.isNotBlank(dependentId) && !StringUtils.equals(dependentId, importChannel.getId())) { channelDependencies.add(new ChannelDependency(dependentId, importChannel.getId())); } } } if (CollectionUtils.isNotEmpty(importChannel.getDependencyIds())) { for (String dependencyId : importChannel.getDependencyIds()) { if (StringUtils.isNotBlank(dependencyId) && !StringUtils.equals(dependencyId, importChannel.getId())) { channelDependencies.add(new ChannelDependency(importChannel.getId(), dependencyId)); } } } if (!channelDependencies.equals(getCachedChannelDependencies())) { try { parent.mirthClient.setChannelDependencies(channelDependencies); } catch (ClientException e) { parent.alertThrowable(parent, e, "Unable to save channel dependencies."); } } importChannel.clearDependencies(); } // Update resource names parent.updateResourceNames(importChannel); /* * Update the channel if we're overwriting an imported channel, if we're not showing alerts * (dragging/dropping multiple channels), or if we're working with an invalid channel. */ if (overwrite || !showAlerts || importChannel instanceof InvalidChannel) { try { parent.updateChannel(importChannel, overwrite); if (importChannel instanceof InvalidChannel && showAlerts) { InvalidChannel invalidChannel = (InvalidChannel) importChannel; Throwable cause = invalidChannel.getCause(); parent.alertThrowable(parent, cause, "Channel \"" + importChannel.getName() + "\" is invalid. " + getMissingExtensions(invalidChannel) + " Original cause:\n" + cause.getMessage()); } } catch (Exception e) { channelStatuses.remove(importChannel.getId()); parent.updateChannelTags(false); parent.alertThrowable(parent, e); return null; } finally { if (refreshStatuses) { doRefreshChannels(); } } } if (showAlerts) { final Channel importChannelFinal = importChannel; final boolean overwriteFinal = overwrite; /* * MIRTH-2048 - This is a hack to fix the memory access error that only occurs on OS X. * The block of code that edits the channel needs to be invoked later so that the screen * does not change before the drag/drop action of a channel finishes. */ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { parent.editChannel(importChannelFinal); parent.setSaveEnabled(!overwriteFinal); } catch (Exception e) { channelStatuses.remove(importChannelFinal.getId()); parent.updateChannelTags(false); parent.alertError(parent, "Channel had an unknown problem. Channel import aborted."); parent.channelEditPanel = new ChannelSetup(); parent.doShowChannel(); } } }); } return importChannel; }
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
private void handleFieldLocator(FieldLocatorData currLocatorData) throws SAXException { handleFieldLocatorCDATA();//w w w . j av a2 s. c om if (currLocatorData.locator != null && currLocatorData.locator.isEmpty()) { currLocatorData.locator = null; } // make sure common required fields are present if (currLocatorData.locator == null && currLocatorData.value == null) { throw new SAXParseException( StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.must.contain", FIELD_LOC_ELMT, LOCATOR_ATTR, VALUE_ATTR), currParseLocation); } if (currLocatorData.locator != null && currLocatorData.value != null) { throw new SAXParseException( StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.cannot.contain", FIELD_LOC_ELMT, LOCATOR_ATTR, VALUE_ATTR), currParseLocation); } ActivityFieldLocator afl = currLocatorData.value != null ? new ActivityFieldLocator(currLocatorData.value) : new ActivityFieldLocator(currLocatorData.locatorType, currLocatorData.locator); afl.setRadix(currLocatorData.radix); afl.setRequired(currLocatorData.reqVal); afl.setId(currLocatorData.id); if (currLocatorData.format != null) { afl.setFormat(currLocatorData.format, currLocatorData.locale); } if (currLocatorData.dataType != null) { afl.setDataType(currLocatorData.dataType); } if (currLocatorData.units != null) { afl.setUnits(currLocatorData.units); } if (currLocatorData.timeZone != null) { afl.setTimeZone(currLocatorData.timeZone); } if (CollectionUtils.isNotEmpty(currLocatorData.valueMapItems)) { for (FieldLocatorData.ValueMapData vmd : currLocatorData.valueMapItems) { afl.addValueMap(vmd.source, vmd.target, vmd.mapTyp); } } if (CollectionUtils.isNotEmpty(currLocatorData.valueTransforms)) { for (ValueTransformation<Object, Object> vt : currLocatorData.valueTransforms) { afl.addTransformation(vt); } } if (currLocatorData.filter != null) { afl.setFilter(currLocatorData.filter); } currField.addLocator(afl); }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
private void addDependenciesToChannel(Channel channel) { Set<String> dependentIds = new HashSet<String>(); Set<String> dependencyIds = new HashSet<String>(); for (ChannelDependency channelDependency : getCachedChannelDependencies()) { if (StringUtils.equals(channelDependency.getDependencyId(), channel.getId())) { dependentIds.add(channelDependency.getDependentId()); } else if (StringUtils.equals(channelDependency.getDependentId(), channel.getId())) { dependencyIds.add(channelDependency.getDependencyId()); }/*from w ww . ja v a2 s . c o m*/ } if (CollectionUtils.isNotEmpty(dependentIds)) { channel.setDependentIds(dependentIds); } if (CollectionUtils.isNotEmpty(dependencyIds)) { channel.setDependencyIds(dependencyIds); } }
From source file:com.evolveum.midpoint.gui.api.util.WebComponentUtil.java
public static <AR extends AbstractRoleType> IModel<String> createAbstractRoleConfirmationMessage( String actionName, ColumnMenuAction action, MainObjectListPanel<AR> abstractRoleTable, PageBase pageBase) {/*w ww . jav a2s. c o m*/ List<AR> selectedRoles = new ArrayList<>(); if (action.getRowModel() == null) { selectedRoles.addAll(abstractRoleTable.getSelectedObjects()); } else { selectedRoles.add(((SelectableBean<AR>) action.getRowModel().getObject()).getValue()); } OperationResult result = new OperationResult("Search Members"); boolean atLeastOneWithMembers = false; for (AR selectedRole : selectedRoles) { ObjectQuery query = QueryBuilder.queryFor(FocusType.class, pageBase.getPrismContext()) .item(FocusType.F_ROLE_MEMBERSHIP_REF) .ref(ObjectTypeUtil.createObjectRef(selectedRole).asReferenceValue()).maxSize(1).build(); List<PrismObject<FocusType>> members = WebModelServiceUtils.searchObjects(FocusType.class, query, result, pageBase); if (CollectionUtils.isNotEmpty(members)) { atLeastOneWithMembers = true; break; } } String members = atLeastOneWithMembers ? ".members" : ""; if (action.getRowModel() == null) { return pageBase.createStringResource("pageRoles.message.confirmationMessageForMultipleObject" + members, actionName, abstractRoleTable.getSelectedObjectsCount()); } else { return pageBase.createStringResource("pageRoles.message.confirmationMessageForSingleObject" + members, actionName, ((ObjectType) ((SelectableBean) action.getRowModel().getObject()).getValue()).getName()); } }