@Override public List<T> apply( String value ) { List<T> list = new ArrayList<>(); String[] parts = value.split( separator ); for ( String part : parts ) { part = part.trim(); if ( StringUtils.isNotEmpty( part ) ) { list.add( itemParser.apply( part ) ); } } return list; }
@Override public void setValueWithOldSetting( String value, Map<String,String> rawConfiguration ) { if ( StringUtils.isNotEmpty( value ) ) { String oldSettingDefaultValue = GraphDatabaseSettings.index_sampling_buffer_size.getDefaultValue(); Long newValue = oldSettingDefaultValue.equals( value ) ? ByteUnit.mebiBytes( 8 ) : Settings.BYTES.apply( value ); rawConfiguration.put( "dbms.index_sampling.sample_size_limit", String.valueOf( newValue ) ); } } } );
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception { if (!(parentElement instanceof TimerEventDefinition)) return; TimerEventDefinition eventDefinition = (TimerEventDefinition) parentElement; if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_END_DATE))) { eventDefinition.setEndDate(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_END_DATE)); } eventDefinition.setTimeCycle(xtr.getElementText()); } }
if(mf != null){ String cp = mf.getMainAttributes().getValue("Class-Path"); if (StringUtils.isNotEmpty(cp)) { for (String fn : cp.split(" ")) { if (!fn.equals(".")) { cname = cname.substring(pIndex+1); if(!packages.containsKey(pname)) packages.put(pname, new ArrayList<String>()); packages.get(pname).add(cname); cname = cname.substring(pIndex); if(!packages.containsKey(pname)) packages.put(pname, new ArrayList<String>()); packages.get(pname).add(cname);
public void createMessages(BpmnModel bpmnModel) { for (Message messageElement : bpmnModel.getMessages()) { if (!messageDefinitionMap.containsKey(messageElement.getId())) { MessageDefinition messageDefinition = new MessageDefinition(messageElement.getId()); if (StringUtils.isNotEmpty(messageElement.getItemRef())) { if (itemDefinitionMap.containsKey(messageElement.getItemRef())) { ItemDefinition itemDefinition = itemDefinitionMap.get(messageElement.getItemRef()); messageDefinition.setItemDefinition(itemDefinition); } } messageDefinitionMap.put(messageDefinition.getId(), messageDefinition); } } }
public static String replaceRegexs(String srcUrl, String regex, Map<String, String> params) { if(params == null) { return srcUrl; } StringBuffer sb = new StringBuffer(); Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(srcUrl); while(matcher.find()) { String name = matcher.group(1); String value = params.get(name); if(StringUtils.isNotEmpty(value)) { matcher.appendReplacement(sb, value); } } matcher.appendTail(sb); return sb.toString(); }
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception { String source = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE); String sourceExpression = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE_EXPRESSION); String target = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_TARGET); if ((StringUtils.isNotEmpty(source) || StringUtils.isNotEmpty(sourceExpression)) && StringUtils.isNotEmpty(target)) { IOParameter parameter = new IOParameter(); if (StringUtils.isNotEmpty(sourceExpression)) { parameter.setSourceExpression(sourceExpression); } else { parameter.setSource(source); } parameter.setTarget(target); ((CallActivity) parentElement).getOutParameters().add(parameter); } } }
while (headers.hasMoreElements()) { Header header = (Header) headers.nextElement(); if (StringUtils.isNotEmpty(header.getValue()) && capturedHeadersList.contains(header.getName().toLowerCase())) { attributes.put("email.headers." + header.getName().toLowerCase(), header.getValue()); if (StringUtils.isNotEmpty(originalMessage.getMessageID())) { attributes.put(EMAIL_HEADER_MESSAGE_ID, originalMessage.getMessageID()); attributes.put(EMAIL_HEADER_RECV_DATE, originalMessage.getReceivedDate().toString()); attributes.put(EMAIL_HEADER_SENT_DATE, originalMessage.getSentDate().toString()); if (StringUtils.isNotEmpty(originalMessage.getSubject())) { attributes.put(EMAIL_HEADER_SUBJECT, originalMessage.getSubject()); invalidFlowFilesList.add(originalFlowFile);
private Map<String, Object> completeTask(Action action, Object payload, TaskDetails taskDetails, Status status, String event, String messageId) { input.put("workflowId", taskDetails.getWorkflowId()); input.put("taskId", taskDetails.getTaskId()); input.put("taskRefName", taskDetails.getTaskRefName()); input.putAll(taskDetails.getOutput()); String workflowId = (String) replaced.get("workflowId"); String taskId = (String) replaced.get("taskId"); String taskRefName = (String) replaced.get("taskRefName"); if (StringUtils.isNotEmpty(taskId)) { task = executor.getTask(taskId); } else if (StringUtils.isNotEmpty(workflowId) && StringUtils.isNotEmpty(taskRefName)) { Workflow workflow = executor.getWorkflow(workflowId, true); if (workflow == null) {
for (JsonNode eventNode : eventsNode) { JsonNode eventValueNode = eventNode.get(PROPERTY_EVENTLISTENER_EVENT); if (eventValueNode != null && !eventValueNode.isNull() && StringUtils.isNotEmpty(eventValueNode.asText())) { if (eventsBuilder.length() > 0) { eventsBuilder.append(","); if ("error".equalsIgnoreCase(rethrowTypeNode.asText())) { String errorCode = getValueAsString("errorcode", listenerNode); if (StringUtils.isNotEmpty(errorCode)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT); listener.setImplementation(errorCode); if (StringUtils.isNotEmpty(messageName)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT); listener.setImplementation(messageName); if (StringUtils.isNotEmpty(signalName)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT); listener.setImplementation(signalName); if (StringUtils.isNotEmpty(signalName)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT); listener.setImplementation(signalName); if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_EVENTLISTENER_CLASS_NAME, listenerNode))) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS); listener.setImplementation(getValueAsString(PROPERTY_EVENTLISTENER_CLASS_NAME, listenerNode)); } else if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_EVENTLISTENER_DELEGATE_EXPRESSION, listenerNode))) {
Map<String, String> tmpParams = new HashMap<>(16); for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) { tmpParams.put(entry.getKey(), entry.getValue()[0]); String limitedUrls = WebUtils.required(request, "limitedUrls"); if (!StringUtils.isEmpty(limitedUrls)) { String[] entries = limitedUrls.split(","); for (int i = 0; i < entries.length; i++) { if (StringUtils.isEmpty(limitedUrl)) { throw new IllegalArgumentException("url can not be empty, url: " + limitedUrl); limitedUrlMap.put(limitedUrl, statusCode); String enable = WebUtils.required(request, "enableStandalone"); if (!StringUtils.isNotEmpty(enable)) { Switch.setEnableStandalone(Boolean.parseBoolean(enable));
domObj.setEnableClientBeat(eanbleClientBeat); if (StringUtils.isNotEmpty(serviceMetadataJson)) { domObj.setMetadata(JSON.parseObject(serviceMetadataJson, new TypeReference<Map<String, String>>() { })); if (StringUtils.isNotEmpty(envAndSite) && StringUtils.isNotEmpty(disabledSites)) { throw new IllegalArgumentException("envAndSite and disabledSites are not allowed both not empty."); if (!StringUtils.isEmpty(clusters)) { domObj.getClusterMap().put(cluster.getName(), cluster); cluster.setDefCkport(defCkport); if (StringUtils.isNotEmpty(clusterMetadataJson)) { cluster.setMetadata(JSON.parseObject(clusterMetadataJson, new TypeReference<Map<String, String>>() { })); domObj.getClusterMap().put(clusterName, cluster);
ItemDefinition itemSubjectRef = new ItemDefinition(); String structureRef = xtr.getAttributeValue(null, ATTRIBUTE_DATA_ITEM_REF); if (StringUtils.isNotEmpty(structureRef) && structureRef.contains(":")) { String dataType = structureRef.substring(structureRef.indexOf(':') + 1); dataObject = new DateDataObject(); } else { LOGGER.error("Error converting {}, invalid data type: " + dataType, xtr.getAttributeValue(null, ATTRIBUTE_DATA_NAME)); dataObject.setId(xtr.getAttributeValue(null, ATTRIBUTE_DATA_ID)); dataObject.setName(xtr.getAttributeValue(null, ATTRIBUTE_DATA_NAME)); List<ExtensionElement> valuesElement = dataObject.getExtensionElements().get("value"); if (valuesElement != null && !valuesElement.isEmpty()) { ExtensionElement valueElement = valuesElement.get(0); if (StringUtils.isNotEmpty(valueElement.getElementText())) { if (dataObject instanceof DateDataObject) { try {
if (!StringUtils.isEmpty(owners)) { dom.setOwners(Arrays.asList(owners.split(","))); if (!StringUtils.isEmpty(token)) { dom.setToken(token); if (!StringUtils.isEmpty(enableClientBeat)) { dom.setEnableClientBeat(Boolean.parseBoolean(enableClientBeat)); if (!StringUtils.isEmpty(sitegroup) || !StringUtils.isEmpty(setSiteGroupForce)) { Cluster cluster = dom.getClusterMap().get(WebUtils.optional(request, "cluster", UtilsAndCommons.DEFAULT_CLUSTER_NAME)); if (cluster == null) { throw new IllegalStateException("cluster not found"); if (!StringUtils.isEmpty(cktype)) { Cluster cluster = dom.getClusterMap().get(WebUtils.optional(request, "cluster", UtilsAndCommons.DEFAULT_CLUSTER_NAME)); if (cluster == null) { throw new IllegalStateException("cluster not found"); if (!StringUtils.isNotEmpty(ipDeletedTimeout)) { long timeout = Long.parseLong(ipDeletedTimeout); if (timeout < VirtualClusterDomain.MINIMUM_IP_DELETE_TIMEOUT) {
if (StringUtils.isNotEmpty(taskId)) { taskOptional = workflow.getTasks().stream().filter(task -> !task.getStatus().isTerminal() && task.getTaskId().equals(taskId)).findFirst(); } else if(StringUtils.isEmpty(taskRefName)) { logger.error("No taskRefName found in the message. If there is only one WAIT task, will mark it as completed. {}", payload); taskOptional = workflow.getTasks().stream().filter(task -> !task.getStatus().isTerminal() && task.getTaskType().equals(Wait.NAME)).findFirst();
@Override protected void validateAttributes(ValidationContext validationContext) { if (StringUtils.isNotEmpty(srcdir) && StringUtils.isNotEmpty(srcfile)) { addError(SRC, "Only one of srcfile or srcdir is allowed at a time"); } if (StringUtils.isEmpty(srcdir) && StringUtils.isEmpty(srcfile)) { addError(SRC, "Should provide either srcdir or srcfile"); } validateFilePath(validationContext, srcfile, SRC); validateFilePath(validationContext, srcdir, SRC); validateFilePath(validationContext, dest, DEST); }
@Override protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception { ScriptTask scriptTask = new ScriptTask(); BpmnXMLUtil.addXMLLocation(scriptTask, xtr); scriptTask.setScriptFormat(xtr.getAttributeValue(null, ATTRIBUTE_TASK_SCRIPT_FORMAT)); scriptTask.setResultVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE)); if (StringUtils.isEmpty(scriptTask.getResultVariable())) { scriptTask.setResultVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE)); } String autoStoreVariables = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE); if (StringUtils.isNotEmpty(autoStoreVariables)) { scriptTask.setAutoStoreVariables(Boolean.valueOf(autoStoreVariables)); } parseChildElements(getXMLElementName(), scriptTask, childParserMap, model, xtr); return scriptTask; }
@Override public Map<String, Object> populateModelVariables(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) { String contentType = tagAttributes.get("contentType"); String contentName = tagAttributes.get("contentName"); String maxResultsStr = tagAttributes.get("maxResults"); if (StringUtils.isEmpty(contentType) && StringUtils.isEmpty(contentName)) { throw new IllegalArgumentException("The content processor must have a non-empty attribute value for 'contentType' or 'contentName'"); if (StringUtils.isNotEmpty(sorts)) { final BroadleafTemplateContext finalContext = context; if (StringUtils.isNotEmpty(fieldFilters)) { List<BroadleafAssignation> assignments = context.getAssignationSequence(fieldFilters, false); boolean valid = true; contentItemFields.add(item.getValues()); contentItemFields.add(item.getValues()); newModelVars.put(contentItemVar, contentItem); newModelVars.put(contentListVar, contentItemFields); newModelVars.put(numResultsVar, contentItems.size()); } else { if (LOG.isInfoEnabled()) {
protected static void writeExtensionElement(ExtensionElement extensionElement, Map<String, String> namespaceMap, XMLStreamWriter xtw) throws Exception { if (StringUtils.isNotEmpty(extensionElement.getName())) { Map<String, String> localNamespaceMap = new HashMap<String, String>(); if (StringUtils.isNotEmpty(extensionElement.getNamespace())) { if (StringUtils.isNotEmpty(extensionElement.getNamespacePrefix())) { xtw.writeStartElement(extensionElement.getNamespacePrefix(), extensionElement.getName(), extensionElement.getNamespace()); if (!namespaceMap.containsKey(extensionElement.getNamespacePrefix()) || !namespaceMap.get(extensionElement.getNamespacePrefix()).equals(extensionElement.getNamespace())) { namespaceMap.put(extensionElement.getNamespacePrefix(), extensionElement.getNamespace()); localNamespaceMap.put(extensionElement.getNamespacePrefix(), extensionElement.getNamespace()); if (StringUtils.isNotEmpty(attribute.getName()) && attribute.getValue() != null) { if (StringUtils.isNotEmpty(attribute.getNamespace())) { if (StringUtils.isNotEmpty(attribute.getNamespacePrefix())) { if (!namespaceMap.containsKey(attribute.getNamespacePrefix()) || !namespaceMap.get(attribute.getNamespacePrefix()).equals(attribute.getNamespace())) { namespaceMap.put(attribute.getNamespacePrefix(), attribute.getNamespace());
static public List<String> readLines(Reader input) throws IOException { BufferedReader reader = toBufferedReader(input); List<String> list = new ArrayList<String>(); String line = null; for (; ; ) { line = reader.readLine(); if (null != line) { if (StringUtils.isNotEmpty(line)) { list.add(line.trim()); } } else { break; } } return list; }