private ArrayList<QueuedItem> parseExecutionListResult(final WebserviceResponse response) { final Document resultDoc = response.getResultDoc(); final Node node = resultDoc.selectSingleNode("/result/executions"); final List items = node.selectNodes("execution"); final ArrayList<QueuedItem> list = new ArrayList<QueuedItem>(); if (null != items && items.size() > 0) { for (final Object o : items) { final Node node1 = (Node) o; final String id = node1.selectSingleNode("@id").getStringValue(); final Node jobname = node1.selectSingleNode("job/name"); final Node desc = node1.selectSingleNode("description"); final String name; if (null != jobname) { name = jobname.getStringValue(); } else { name = desc.getStringValue(); } String url = node1.selectSingleNode("@href").getStringValue(); url = makeAbsoluteURL(url); logger.info("\t" + ": " + name + " [" + id + "] <" + url + ">"); list.add(QueuedItemResultImpl.createQueuedItem(id, url, name)); } } return list; }
@SuppressWarnings("unchecked") @Override public Relationship parse(Node relationshipNode) { Node schemaNode = relationshipNode.selectSingleNode("@schema"); String schemaName = schemaNode != null ? schemaNode.getText().trim() : null; String tableName = relationshipNode.selectSingleNode("@table").getText().trim(); LOG.info("creating composite to extract " + tableName); CompositeReferingToMultipleTablesRelationship relationship = new CompositeReferingToMultipleTablesRelationship(schemaName, tableName); List<Node> relateNodes = relationshipNode.selectNodes("relate"); for (Node relateNode : relateNodes) { String column = relateNode.selectSingleNode("@column").getText().trim(); String seedTableName = relateNode.selectSingleNode("@seedTable").getText().trim(); String seedColumn = relateNode.selectSingleNode("@seedColumn").getText().trim(); LOG.info( String.format( "\tadding relationship to composite %s.%s ->%s.%s", seedTableName, seedColumn, tableName, column)); relationship.addTableRelationship(column, seedTableName, seedColumn); } return relationship; }
private void addComponentMsgContent(Component component, String prefix) { List<?> msgContentsNodes = getMsgContents(component.getMsgID()); System.out.println(prefix + " " + component.getName()); if (!component.getMsgContent().isEmpty()) { System.out.println(prefix + "\talready handled, return"); return; } for (Object o : msgContentsNodes) { Node node = (Node) o; String tagText = node.selectSingleNode("TagText").getText(); String reqd = node.selectSingleNode("Reqd").getText(); if (allFields.containsKey(tagText)) { ComponentField componentField = new ComponentField(allFields.get(tagText), reqd); component.addMsgContent(componentField); System.out.println(prefix + "\t " + allFields.get(tagText).getFieldName()); } else if (allComponents.containsKey(tagText)) { // Handle msgContents for the component in question first! addComponentMsgContent(allComponents.get(tagText), prefix + "\t"); ComponentComponent componentComponent = new ComponentComponent(allComponents.get(tagText), reqd); component.addMsgContent(componentComponent); System.out.println(prefix + "\t " + allComponents.get(tagText).getName()); } else { System.err.println("Could not find tagText: " + tagText); } } }
private IStoredJobLoadResult parseAPIJobResult( final Node node1, final boolean successful, final boolean skippedJob, final String message) { final Node uuidNode = node1.selectSingleNode("uuid"); final Node idNode = node1.selectSingleNode("id"); final String id = null != uuidNode ? uuidNode.getStringValue() : null != idNode ? idNode.getStringValue() : null; final String name = node1.selectSingleNode("name").getStringValue(); final String url = null != id ? createJobURL(id) : null; final String group = null != node1.selectSingleNode("group") ? node1.selectSingleNode("group").getStringValue() : null; final String description = null != node1.selectSingleNode("description") ? node1.selectSingleNode("description").getStringValue() : null; final String project = null != node1.selectSingleNode("project") ? node1.selectSingleNode("project").getStringValue() : null; logger.debug("\t" + name + " [" + id + "] <" + url + "> (" + project + ")"); return StoredJobLoadResultImpl.createLoadResult( id, name, url, group, description, project, successful, skippedJob, message); }
/** * Parse plugins configuration file, get all plugin configurations。 * * @return a map mapping plugin name to plugin configurations。 */ @SuppressWarnings("unchecked") public static Map<String, PluginConf> loadPluginConfig() { Map<String, PluginConf> plugins = new HashMap<String, PluginConf>(); File file = new File(Constants.PLUGINSXML); SAXReader saxReader = new SAXReader(); Document document = null; try { document = saxReader.read(file); } catch (Exception e) { LOG.error("DataX Can not find " + Constants.PLUGINSXML); throw new DataExchangeException(e.getCause()); } String xpath = "/plugins/plugin"; List<Node> pluginnode = (List<Node>) document.selectNodes(xpath); for (Node node : pluginnode) { PluginConf plugin = new PluginConf(); plugin.setVersion(node.selectSingleNode("./version").getStringValue()); plugin.setName(node.selectSingleNode("./name").getStringValue()); plugin.setTarget(node.selectSingleNode("./target").getStringValue()); plugin.setJar(node.selectSingleNode("./jar").getStringValue()); plugin.setType(node.selectSingleNode("./type").getStringValue()); plugin.setClassName(node.selectSingleNode("./class").getStringValue()); plugin.setMaxthreadnum( Integer.parseInt(node.selectSingleNode("./maxthreadnum").getStringValue())); if (node.selectSingleNode("./path") != null) plugin.setPath(node.selectSingleNode("./path").getStringValue()); plugins.put(plugin.getName(), plugin); } return plugins; }
public Collection<IStoredJob> reallistStoredJobs(final IStoredJobsQuery iStoredJobsQuery) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); final String nameMatch = iStoredJobsQuery.getNameMatch(); String groupMatch = iStoredJobsQuery.getGroupMatch(); final String projectFilter = iStoredJobsQuery.getProjectFilter(); final String idlistFilter = iStoredJobsQuery.getIdlist(); if (null != nameMatch) { params.put("jobExactFilter", nameMatch); } if (null != groupMatch) { final Matcher matcher = Pattern.compile("^/*(.+?)/*$").matcher(groupMatch); if (matcher.matches()) { // strip leading and trailing slashes groupMatch = matcher.group(1); } params.put("groupPathExact", groupMatch); } if (null != projectFilter) { params.put("project", projectFilter); } if (null != idlistFilter) { params.put("idlist", idlistFilter); } // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_API_JOBS_LIST_PATH, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } validateResponse(response); // extract job list final Document resultDoc = response.getResultDoc(); final ArrayList<IStoredJob> list = new ArrayList<IStoredJob>(); final Node jobs = resultDoc.selectSingleNode("/result/jobs"); for (final Object job1 : jobs.selectNodes("job")) { final Node job = (Node) job1; final String id = job.selectSingleNode("@id").getStringValue(); final String name = job.selectSingleNode("name").getStringValue(); final String group = job.selectSingleNode("group").getStringValue(); final String desc = job.selectSingleNode("description").getStringValue(); final String url = createJobURL(id); list.add(StoredJobImpl.create(id, name, url, group, desc, projectFilter)); } return list; }
private IStoredJobLoadResult parseStoredJobResult( final Node node1, final boolean successful, final boolean skippedJob, final String message) { final String index = node1.selectSingleNode("@index").getStringValue(); final Node idNode = node1.selectSingleNode("id"); final String id = null != idNode ? idNode.getStringValue() : null; final String name = node1.selectSingleNode("name").getStringValue(); final Node urlNode = node1.selectSingleNode("url"); final String url = null != urlNode ? makeAbsoluteURL(urlNode.getStringValue()) : null; final String group = null != node1.selectSingleNode("group") ? node1.selectSingleNode("group").getStringValue() : null; final String description = null != node1.selectSingleNode("description") ? node1.selectSingleNode("description").getStringValue() : null; logger.debug("\t" + index + ": " + name + " [" + id + "] <" + url + ">"); int ndx = -1; try { ndx = Integer.parseInt(index); } catch (NumberFormatException e) { } return StoredJobLoadResultImpl.createLoadResult( id, name, url, group, description, successful, skippedJob, message, ndx); }
private static Object getDefaultValue(final Node parameterNode) { Node rootNode = parameterNode.selectSingleNode("default-value"); // $NON-NLS-1$ if (rootNode == null) { return (null); } String dataType = XmlDom4JHelper.getNodeText("@type", rootNode); // $NON-NLS-1$ if (dataType == null) { dataType = XmlDom4JHelper.getNodeText("@type", parameterNode); // $NON-NLS-1$ } if ("string-list".equals(dataType)) { // $NON-NLS-1$ List nodes = rootNode.selectNodes("list-item"); // $NON-NLS-1$ if (nodes == null) { return (null); } ArrayList rtnList = new ArrayList(); for (Iterator it = nodes.iterator(); it.hasNext(); ) { rtnList.add(((Node) it.next()).getText()); } return (rtnList); } else if ("property-map-list".equals(dataType)) { // $NON-NLS-1$ List nodes = rootNode.selectNodes("property-map"); // $NON-NLS-1$ if (nodes == null) { return (null); } ArrayList rtnList = new ArrayList(); for (Iterator it = nodes.iterator(); it.hasNext(); ) { Node mapNode = (Node) it.next(); rtnList.add(SequenceDefinition.getMapFromNode(mapNode)); } return (rtnList); } else if ("property-map".equals(dataType)) { // $NON-NLS-1$ return (SequenceDefinition.getMapFromNode( rootNode.selectSingleNode("property-map"))); // $NON-NLS-1$ } else if ("long".equals(dataType)) { // $NON-NLS-1$ try { return (new Long(rootNode.getText())); } catch (Exception e) { } return (null); } else if ("result-set".equals(dataType)) { // $NON-NLS-1$ return (MemoryResultSet.createFromActionSequenceInputsNode(parameterNode)); } else { // Assume String return (rootNode.getText()); } }
public static IActionSequence ActionSequenceFactory( final Document document, final String solutionPath, final ILogger logger, final IApplicationContext applicationContext, final int loggingLevel) { // Check for a sequence document Node sequenceDefinitionNode = document.selectSingleNode("//action-sequence"); // $NON-NLS-1$ if (sequenceDefinitionNode == null) { logger.error( Messages.getInstance() .getErrorString( "SequenceDefinition.ERROR_0002_NO_ACTION_SEQUENCE_NODE", "", solutionPath, "")); //$NON-NLS-1$ return null; } ISequenceDefinition seqDef = new SequenceDefinition(sequenceDefinitionNode, solutionPath, logger, applicationContext); Node actionNode = sequenceDefinitionNode.selectSingleNode("actions"); // $NON-NLS-1$ return (SequenceDefinition.getNextLoopGroup( seqDef, actionNode, solutionPath, logger, loggingLevel)); }
public DispatcherResult killDispatcherExecution(final String execId) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); final String rundeckApiKillJobPath = substitutePathVariable(RUNDECK_API_KILL_JOB_PATH, "id", execId); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(rundeckApiKillJobPath, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } final Envelope envelope = validateResponse(response); final Node result1 = envelope.doc.selectSingleNode("result"); final String abortStatus = result1.selectSingleNode("abort/@status").getStringValue(); final boolean result = !"failed".equals(abortStatus); final StringBuffer sb = envelope.successMessages(); return new DispatcherResult() { public boolean isSuccessful() { return result; } public String getMessage() { return sb.toString(); } }; }
/** * @param componentDefinition * @param props */ private static void updateComponent(final Element componentDefinition, final HashMap props) { Iterator iter = props.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); Node node = componentDefinition.selectSingleNode(key.toString()); if (node == null) { node = componentDefinition.addElement(key.toString()); } if (PivotViewComponent.OPTIONS.equals(node.getName())) { List optionsList = (List) props.get(key); Iterator optsIter = optionsList.iterator(); while (optsIter.hasNext()) { String anOption = optsIter.next().toString(); Node anOptionNode = node.selectSingleNode(anOption); if (anOptionNode == null) { ((Element) node).addElement(anOption); } } } else { Object value = props.get(key); if (value != null) { // remove existing text node.setText(""); // $NON-NLS-1$ ((Element) node).addCDATA(value.toString()); } } } // the property "mdx" is no longer being put in the hashmap. So, // query will be passed properly now. }
@Override public MailboxPreferences readObject(Document doc) { MailboxPreferences prefs = new MailboxPreferences(); Node root = doc.getRootElement(); String greetingId = root.valueOf("activegreeting"); MailboxPreferences.ActiveGreeting greeting = MailboxPreferences.ActiveGreeting.valueOfById(greetingId); prefs.setActiveGreeting(greeting); Element imap = (Element) root.selectSingleNode("imapserver"); if (imap != null) { prefs.setEmailServerHost(imap.attributeValue("host")); prefs.setEmailServerPort(imap.attributeValue("port")); prefs.setEmailServerUseTLS(YES.equals(imap.attributeValue("UseTLS"))); } List<Element> contacts = root.selectNodes("notification/contact"); prefs.setEmailAddress(getEmailAddress(0, contacts)); prefs.setAlternateEmailAddress(getEmailAddress(1, contacts)); prefs.setAttachVoicemailToEmail(getAttachVoicemail(0, contacts)); prefs.setAttachVoicemailToAlternateEmail(getAttachVoicemail(1, contacts)); String pwd = getPassword(0, contacts); String decodedPwd = pwd != null ? new String(Base64.decodeBase64(pwd.getBytes())) : null; prefs.setEmailPassword(decodedPwd); boolean synchronize = getSynchronize(0, contacts); boolean attachFirstVoicemailToEmail = getAttachVoicemail(0, contacts); prefs.setSynchronizeWithEmailServer(synchronize); if (synchronize) { prefs.setVoicemailProperties(MailboxPreferences.SYNCHRONIZE_WITH_EMAIL_SERVER); } else if (attachFirstVoicemailToEmail) { prefs.setVoicemailProperties(MailboxPreferences.ATTACH_VOICEMAIL); } else { prefs.setVoicemailProperties(MailboxPreferences.DO_NOT_ATTACH_VOICEMAIL); } return prefs; }
@Override public DeleteExecutionsResponse parse(final Node baseNode) { final DeleteExecutionsResponse response = new DeleteExecutionsResponse(); response.setAllsuccessful(Boolean.parseBoolean(baseNode.valueOf("@allsuccessful"))); response.setRequestCount(Integer.parseInt(baseNode.valueOf("@requestCount"))); response.setSuccessCount(Integer.parseInt(baseNode.valueOf("successful/@count"))); final Node failedNode = baseNode.selectSingleNode("failed"); // parse failures final List<DeleteExecutionsResponse.DeleteFailure> failures = new ArrayList<DeleteExecutionsResponse.DeleteFailure>(); int failedCount = 0; if (null != failedNode) { failedCount = Integer.parseInt(baseNode.valueOf("failed/@count")); final List list = baseNode.selectNodes("failed/execution"); for (final Object o : list) { final Node execNode = (Node) o; final DeleteExecutionsResponse.DeleteFailure deleteFailure = new DeleteExecutionsResponse.DeleteFailure(); deleteFailure.setExecutionId(Long.parseLong(execNode.valueOf("@id"))); deleteFailure.setMessage(execNode.valueOf("@message")); failures.add(deleteFailure); } } response.setFailedCount(failedCount); response.setFailures(failures); return response; }
public void setPlotBackground(final Node plotBackgroundNode) { if (plotBackgroundNode != null) { Node backgroundTypeNode = plotBackgroundNode.selectSingleNode(ChartDefinition.BACKGROUND_TYPE_ATTRIBUTE_NAME); if (backgroundTypeNode != null) { String backgroundTypeStr = backgroundTypeNode.getText(); if (ChartDefinition.COLOR_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) { setPlotBackgroundPaint(JFreeChartEngine.getPaint(plotBackgroundNode)); setPlotBackgroundImage((Image) null); } else if (ChartDefinition.IMAGE_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) { setPlotBackgroundImage(plotBackgroundNode); setPlotBackgroundPaint(null); } else if (ChartDefinition.TEXTURE_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) { setPlotBackgroundPaint( JFreeChartEngine.getTexturePaint( plotBackgroundNode, getWidth(), getHeight(), getSession())); setPlotBackgroundImage((Image) null); } else if (ChartDefinition.GRADIENT_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) { setPlotBackgroundPaint( JFreeChartEngine.getGradientPaint(plotBackgroundNode, getWidth(), getHeight())); setPlotBackgroundImage((Image) null); } } } }
@Override public Dataset createChart(final Document doc) { if (actionPath != null) { // if we have a solution then get the values values = getActionData(); } else { // TODO support other methods of getting data } if (values == null) { // we could not get any data return null; } // get the chart node from the document Node chartAttributes = doc.selectSingleNode("//" + AbstractChartComponent.CHART_NODE_NAME); // $NON-NLS-1$ // create the definition TimeSeriesCollectionChartDefinition chartDefinition = new TimeSeriesCollectionChartDefinition( (IPentahoResultSet) values, byRow, chartAttributes, getSession()); // set the misc values from chartDefinition setChartType(chartDefinition.getChartType()); setTitle(chartDefinition.getTitle()); // get the URL template Node urlTemplateNode = chartAttributes.selectSingleNode(AbstractChartComponent.URLTEMPLATE_NODE_NAME); if (urlTemplateNode != null) { setUrlTemplate(urlTemplateNode.getText()); } // get the additional parameter Node paramName2Node = chartAttributes.selectSingleNode(AbstractChartComponent.PARAM2_NODE_NAME); if (paramName2Node != null) { seriesName = paramName2Node.getText(); } if ((chartDefinition.getWidth() != -1) && (width == -1)) { setWidth(chartDefinition.getWidth()); } if ((chartDefinition.getHeight() != -1) && (height == -1)) { setHeight(chartDefinition.getHeight()); } return chartDefinition; }
public ActionDefinition(final Node actionRootNode, final ILogger logger) { this.actionRootNode = actionRootNode; errorCode = ISequenceDefinition.ACTION_SEQUENCE_DEFINITION_OK; // this.sequenceData = sequenceData; // get the input parameter definitions actionInputDefinitions = new ListOrderedMap(); actionInputMapping = new ListOrderedMap(); errorCode = SequenceDefinition.parseParameters( actionRootNode, logger, "action-inputs/*", actionInputDefinitions, actionInputMapping, true); //$NON-NLS-1$ // get the ouput definitions actionOutputDefinitions = new ListOrderedMap(); actionOutputMapping = new ListOrderedMap(); errorCode = SequenceDefinition.parseParameters( actionRootNode, logger, "action-outputs/*", actionOutputDefinitions, actionOutputMapping, false); //$NON-NLS-1$ // get the resource definitions actionResourceMapping = new ListOrderedMap(); if (actionRootNode.selectNodes("action-resources/*").size() > 0) { // $NON-NLS-1$ hasActionResources = true; errorCode = SequenceDefinition.parseActionResourceDefinitions( actionRootNode, logger, "action-resources/*", actionResourceMapping); // $NON-NLS-1$ } componentName = XmlDom4JHelper.getNodeText("component-name", actionRootNode); // $NON-NLS-1$ String loggingLevelString = XmlDom4JHelper.getNodeText("logging-level", actionRootNode); // $NON-NLS-1$ loggingLevel = Logger.getLogLevel(loggingLevelString); // get the component payload componentNode = actionRootNode.selectSingleNode("component-definition"); // $NON-NLS-1$ if (componentNode == null) { componentNode = ((Element) actionRootNode).addElement("component-definition"); // $NON-NLS-1$ } // TODO populate preExecuteAuditList and postExecuteAuditList }
private void initFields() { System.out.println(getClass().getSimpleName() + ": Init Fields..."); List<?> fieldNodes = fields.selectNodes("//dataroot/Fields"); for (Object o : fieldNodes) { Node node = (Node) o; String tag = node.selectSingleNode("Tag").getText(); String fieldName = node.selectSingleNode("FieldName").getText(); System.out.println("\t " + fieldName + "(" + tag + ")"); String type = node.selectSingleNode("Type").getText(); String desc = node.selectSingleNode("Desc").getText(); String notReqXML = node.selectSingleNode("NotReqXML").getText(); Field field = new Field(tag, fieldName, type, desc, notReqXML); allFields.put(field.getTag(), field); // Find enums List<?> enumNodes = enums.selectNodes("//dataroot/Enums[Tag=" + tag + "]"); Collections.sort(enumNodes, new EnumNodeComparator()); if (!enumNodes.isEmpty()) { for (Object enumO : enumNodes) { Node enumNode = (Node) enumO; String enumName = enumNode.selectSingleNode("Enum").getText(); System.out.println("\t\t " + enumName); String enumDesc = enumNode.selectSingleNode("Description").getText(); field.addEnum(new Enum(enumName, enumDesc)); } } } System.out.println(getClass().getSimpleName() + ": " + allFields.size() + " Fields found"); }
public String selectList( String screenName, String panelname, String querynode, JSONObject jsonObject, InputDTO jsonInput, ResultDTO prevResultDTO) { String parsedquery = ""; try { String xmlconfigfile = ScreenMapRepo.findMapXMLPath(screenName); org.dom4j.Document document1 = new SAXReader().read(xmlconfigfile); org.dom4j.Element root = document1.getRootElement(); Node crudnode = root.selectSingleNode("//crud"); Node node = crudnode.selectSingleNode(querynode); if (node == null) throw new Exception("<" + querynode + "> node not defined"); String outstack = ((Element) node).attributeValue("outstack"); panelname = outstack; String updatequery = ""; updatequery += node.getText(); List<Element> nodeList = crudnode.selectNodes("../fields/field/*"); logger.debug("fields size:" + nodeList.size()); HashMap<String, DataType> hmfielddbtype = new HashMap<String, PrepstmtDTO.DataType>(); QueryParser.populateFieldDBType(nodeList, hmfielddbtype); /*Pattern pattern = Pattern.compile(":(\\w*)",Pattern.DOTALL|Pattern.MULTILINE); Matcher m = pattern.matcher(updatequery); while(m.find()){ String val = ""; logger.debug(m.group(0)+ " "+ m.group(1)); if(jsonObject.has(m.group(1))){ val = jsonObject.getString(m.group(1)); updatequery = updatequery.replaceAll(":"+m.group(1), val); } }*/ // SET List<Element> primarykeys = crudnode.selectNodes("../fields/field/*[@primarykey]"); PrepstmtDTOArray arparam = new PrepstmtDTOArray(); parsedquery = QueryParser.parseQuery( updatequery, panelname, jsonObject, arparam, hmfielddbtype, jsonInput, prevResultDTO); logger.debug( "UPDATE query:" + parsedquery + "\n Expanded prep:" + arparam.toString(parsedquery)); } catch (Exception e) { logger.debug("Exception caught in InsertData", e); } return parsedquery; }
private void initComponents() { System.out.println(getClass().getSimpleName() + ": Init Components..."); List<?> componentNodes = components.selectNodes("//dataroot/Components"); for (Object o : componentNodes) { Node node = (Node) o; String msgID = node.selectSingleNode("MsgID").getText(); String componentName = node.selectSingleNode("ComponentName").getText(); String componentType = node.selectSingleNode("ComponentType").getText(); String category = node.selectSingleNode("Category").getText(); String notReqXML = node.selectSingleNode("NotReqXML").getText(); allComponents.put( componentName, new Component(msgID, componentName, componentType, category, notReqXML)); } System.out.println( getClass().getSimpleName() + ": " + allComponents.size() + " Components found"); // Add msgContents for (Component component : allComponents.values()) { addComponentMsgContent(component, "\t"); } }
public void loadJobNode(Node arg0) throws LoadJobException { try { selectionPanel.getClearButton().doClick(); List fileList = arg0.selectNodes("filelist/file"); for (int i = 0; fileList != null && i < fileList.size(); i++) { Node fileNode = (Node) fileList.get(i); if (fileNode != null) { Node fileName = (Node) fileNode.selectSingleNode("@name"); if (fileName != null && fileName.getText().length() > 0) { Node filePwd = (Node) fileNode.selectSingleNode("@password"); selectionPanel .getLoader() .addFile( new File(fileName.getText()), (filePwd != null) ? filePwd.getText() : null); } } } Node fileDestination = (Node) arg0.selectSingleNode("destination/@value"); if (fileDestination != null) { destinationTextField.setText(fileDestination.getText()); } Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (fileOverwrite != null) { overwriteCheckbox.setSelected(fileOverwrite.getText().equals("true")); } Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value"); if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) { outputCompressedCheck.doClick(); } Node filePrefix = (Node) arg0.selectSingleNode("prefix/@value"); if (filePrefix != null) { outPrefixTextField.setText(filePrefix.getText()); } Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value"); if (pdfVersion != null) { for (int i = 0; i < versionCombo.getItemCount(); i++) { if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) { versionCombo.setSelectedIndex(i); break; } } } log.info(GettextResource.gettext(config.getI18nResourceBundle(), "Decrypt section loaded.")); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error: "), ex); } }
/** * Examines the XML returned about a user to find out if they are enabled or disabled. Returns * <tt>null</tt> when user can log in or a LockOutFlag if user cannot log in. * * @param responseNode Element returned from REST service. (@see #getUserByUsername) * @return Either a LockOutFlag indicating that the user is disabled, or null if everything is * fine. */ private LockOutFlag checkUserDisabled(Node responseNode) { try { Node userNode = responseNode.selectSingleNode("return"); // Gets the username String username = userNode.selectSingleNode("username").getText(); // Escape the username so that it can be used as a JID. username = JID.escapeNode(username); // Gets the enabled field boolean isEnabled = Boolean.valueOf(userNode.selectSingleNode("enabled").getText()); if (isEnabled) { // We're good, indicate that they're not locked out. return null; } else { // Creates the lock out flag return new LockOutFlag(username, null, null); } } catch (Exception e) { // Hrm. This is not good. We have to opt on the side of positive. Log.error("Error while looking up user's disabled status from Clearspace: ", e); return null; } }
public Collection<QueuedItem> listDispatcherQueue() throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); params.put("xmlreq", "true"); final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_LIST_EXECUTIONS_PATH, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } validateResponse(response); //////////////////// // parse result list of queued items, return the collection of QueuedItems /////////////////// final Document resultDoc = response.getResultDoc(); final Node node = resultDoc.selectSingleNode("/result/items"); final List items = node.selectNodes("item"); final ArrayList<QueuedItem> list = new ArrayList<QueuedItem>(); if (null != items && items.size() > 0) { for (final Object o : items) { final Node node1 = (Node) o; final String id = node1.selectSingleNode("id").getStringValue(); final String name = node1.selectSingleNode("name").getStringValue(); String url = node1.selectSingleNode("url").getStringValue(); url = makeAbsoluteURL(url); logger.info("\t" + ": " + name + " [" + id + "] <" + url + ">"); list.add(QueuedItemResultImpl.createQueuedItem(id, url, name)); } } return list; }
@Override public void importSite(String configLocation) { Document document = loadConfiguration(configLocation); if (document != null) { Element root = document.getRootElement(); List<Node> siteNodes = root.selectNodes("site"); if (siteNodes != null) { for (Node siteNode : siteNodes) { String name = siteNode.valueOf("name"); String buildDataLocation = siteNode.valueOf("build-data-location"); String publishingChannelGroup = siteNode.valueOf("publish-channel-group"); String publishStr = siteNode.valueOf("publish"); boolean publish = (!StringUtils.isEmpty(publishStr) && publishStr.equalsIgnoreCase("true")); String publishSize = siteNode.valueOf("publish-chunk-size"); int chunkSize = (!StringUtils.isEmpty(publishSize) && StringUtils.isNumeric(publishSize)) ? Integer.valueOf(publishSize) : -1; Node foldersNode = siteNode.selectSingleNode("folders"); String sourceLocation = buildDataLocation + "/" + name; String delayIntervalStr = siteNode.valueOf("delay-interval"); int delayInterval = (!StringUtils.isEmpty(delayIntervalStr) && StringUtils.isNumeric(delayIntervalStr)) ? Integer.valueOf(delayIntervalStr) : -1; String delayLengthStr = siteNode.valueOf("delay-length"); int delayLength = (!StringUtils.isEmpty(delayLengthStr) && StringUtils.isNumeric(delayLengthStr)) ? Integer.valueOf(delayLengthStr) : -1; importFromConfigNode( name, publishingChannelGroup, foldersNode, sourceLocation, "/", publish, chunkSize, delayInterval, delayLength); } } } }
static IConditionalExecution parseConditionalExecution( final Node actionRootNode, final ILogger logger, final String nodePath) { try { Node condition = actionRootNode.selectSingleNode(nodePath); if (condition == null) { return null; } String script = condition.getText(); IConditionalExecution ce = PentahoSystem.get(IConditionalExecution.class, null); ce.setScript(script); return ce; } catch (Exception ex) { logger.error( Messages.getInstance().getErrorString("SequenceDefinition.ERROR_0005_PARSING_PARAMETERS"), ex); //$NON-NLS-1$ } return null; }
private void initMsgTypes(Map<String, MsgType> msgTypeMap, String notReqXML) { System.out.println(getClass().getSimpleName() + ": Init MsgTypes (" + notReqXML + ")..."); List<?> msgTypeNodes = msgType.selectNodes("//dataroot/MsgType[NotReqXML=" + notReqXML + "]"); for (Object o : msgTypeNodes) { Node node = (Node) o; String msgID = node.selectSingleNode("MsgID").getText(); String messageName = node.selectSingleNode("MessageName").getText(); String componentType = node.selectSingleNode("ComponentType").getText(); String category = node.selectSingleNode("Category").getText(); String msgType = node.selectSingleNode("MsgType").getText(); msgTypeMap.put( msgType, new MsgType(msgID, messageName, componentType, category, notReqXML, msgType)); } System.out.println(getClass().getSimpleName() + ": " + msgTypeMap.size() + " MsgTypes found"); // Add msgContents for (MsgType msgType : msgTypeMap.values()) { List<?> msgContentsNodes = getMsgContents(msgType.getMsgID()); System.out.println("\t " + msgType.getName()); for (Object o : msgContentsNodes) { Node node = (Node) o; String tagText = node.selectSingleNode("TagText").getText(); String reqd = node.selectSingleNode("Reqd").getText(); // if (allFields.containsKey(tagText) && // notReqXML.equals(allFields.get(tagText).getNotReqXML())) { if (allFields.containsKey(tagText)) { MsgTypeField msgTypeField = new MsgTypeField(allFields.get(tagText), reqd); msgType.addMsgContent(msgTypeField); System.out.println("\t\t " + allFields.get(tagText).getFieldName()); // } else if (allComponents.containsKey(tagText) && // notReqXML.equals(allComponents.get(tagText).getNotReqXML())) { } else if (allComponents.containsKey(tagText)) { MsgTypeComponent msgTypeComponent = new MsgTypeComponent(allComponents.get(tagText), reqd); msgType.addMsgContent(msgTypeComponent); System.out.println("\t\t " + allComponents.get(tagText).getName()); } else { System.err.println("Could not find tagText: " + tagText); } } } }
private void setChartAttributes(final Node chartAttributes) { if (chartAttributes == null) { return; } // get the chart type from the chart node -- this overrides the current // chart type setChartType(chartAttributes.selectSingleNode(ChartDefinition.TYPE_NODE_NAME)); // set the chart background setChartBackground( chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME)); // set the plot background setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME)); // set the orientation setOrientation(chartAttributes.selectSingleNode(XYChartDefinition.ORIENTATION_NODE_NAME)); // do we want a legend setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME)); // get the chart title setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME)); // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element // (for XML schema to // be well constructed and validate the XML . // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> // parent node // under which <subtitle> can exist. List subtitles = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME); if ((subtitles == null) || (subtitles.isEmpty())) { Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME); if (subTitlesNode != null) { subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME); } } else { // log a deprecation warning for this property... getLogger() .warn( Messages.getInstance() .getString( "CHART.WARN_DEPRECATED_CHILD", ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME)); // $NON-NLS-1$ getLogger() .warn( Messages.getInstance() .getString( "CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); // $NON-NLS-1$ } if (subtitles != null) { addSubTitles(subtitles); } // get the paint sequence setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME)); Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME); Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME); if (backgroundAlphaNode != null) { setBackgroundAlpha( chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME)); } if (foregroundAlphaNode != null) { setForegroundAlpha( chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME)); } // get the stacked value setStacked(chartAttributes.selectSingleNode(ChartDefinition.STACKED_NODE_NAME)); // get the 3D value setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME)); // set the width setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME)); // set the height setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME)); // set the dot width setDotWidth(chartAttributes.selectSingleNode(ChartDefinition.DOT_WIDTH_NODE_NAME)); // set the dot height setDotHeight(chartAttributes.selectSingleNode(ChartDefinition.DOT_HEIGHT_NODE_NAME)); // set vertical tick labels flag setDomainVerticalTickLabels( chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_VERTICAL_TICK_LABELS_NODE_NAME)); // set the border on or off setBorderVisible( chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME)); // set the border Paint setBorderPaint( JFreeChartEngine.getPaint( chartAttributes.selectSingleNode(XYChartDefinition.CHART_BORDER_PAINT_NODE_NAME))); // set the title location setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME)); // set the legend location setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME)); // set the title font setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME)); // set the domain title setDomainTitle(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_NODE_NAME)); // set the domain font setDomainTitleFont( chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_FONT_NODE_NAME)); // set the range title setRangeTitle(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_NODE_NAME)); // the the range font setRangeTitleFont( chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_FONT_NODE_NAME)); // set the range minimum setRangeMinimum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MINIMUM_NODE_NAME)); // set the range minimum setRangeMaximum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MAXIMUM_NODE_NAME)); // set the date minimum setDateMinimum( chartAttributes.selectSingleNode( TimeSeriesCollectionChartDefinition.DATE_MINIMUM_NODE_NAME)); // set the date minimum setDateMaximum( chartAttributes.selectSingleNode( TimeSeriesCollectionChartDefinition.DATE_MAXIMUM_NODE_NAME)); // set the Period type setDomainPeriodType( chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_PERIOD_TYPE_NODE_NAME)); // set the line style setLineStyle(chartAttributes.selectSingleNode(ChartDefinition.LINE_STYLE_NODE_NAME)); // set the line width setLineWidth(chartAttributes.selectSingleNode(ChartDefinition.LINE_WIDTH_NODE_NAME)); // set the marker visibility setMarkersVisible(chartAttributes.selectSingleNode(ChartDefinition.MARKER_VISIBLE_NODE_NAME)); // set legend font setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME)); // set legend border visible setLegendBorderVisible( chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME)); setTooltipContent( chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_CONTENT_NODE_NAME)); setTooltipYFormat( chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_Y_FORMAT_NODE_NAME)); setTooltipXFormat( chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_X_FORMAT_NODE_NAME)); }
public Collection<IStoredJobLoadResult> loadJobs(ILoadJobsRequest iLoadJobsRequest, File input) throws CentralDispatcherException { final HashMap params = new HashMap(); params.put("dupeOption", iLoadJobsRequest.getDuplicateOption().toString()); params.put("xmlreq", "true"); /* * Send the request bean and the file as a multipart request. */ // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_JOBS_UPLOAD, params, input, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } validateResponse(response); //////////////////// // parse result list of queued items, return the collection of QueuedItems /////////////////// final Document result = response.getResultDoc(); final int succeeded; final int failed; final int skipped; Node node = result.selectSingleNode("/result/succeeded/@count"); if (null != node) { succeeded = Integer.parseInt(node.getStringValue()); } else { succeeded = -1; } node = result.selectSingleNode("/result/failed/@count"); if (null != node) { failed = Integer.parseInt(node.getStringValue()); } else { failed = -1; } node = result.selectSingleNode("/result/skipped/@count"); if (null != node) { skipped = Integer.parseInt(node.getStringValue()); } else { skipped = -1; } ArrayList<IStoredJobLoadResult> resultList = new ArrayList<IStoredJobLoadResult>(); if (succeeded > 0) { logger.debug("Succeeded creating/updating " + succeeded + " Jobs:"); final List nodes = result.selectNodes("/result/succeeded/job"); for (final Object node2 : nodes) { final Node node1 = (Node) node2; final IStoredJobLoadResult storedJobLoadResult = parseStoredJobResult(node1, true, false, "Succeeded"); resultList.add(storedJobLoadResult); } } if (failed > 0) { logger.debug("Failed to add " + failed + " Jobs:"); final List nodes = result.selectNodes("/result/failed/job"); for (final Object node2 : nodes) { final Node node1 = (Node) node2; final String error = null != node1.selectSingleNode("error") ? node1.selectSingleNode("error").getStringValue() : "Failed"; final IStoredJobLoadResult storedJobLoadResult = parseStoredJobResult(node1, false, false, error); resultList.add(storedJobLoadResult); } } if (skipped > 0) { logger.debug("Skipped " + skipped + " Jobs:"); final List nodes = result.selectNodes("/result/skipped/job"); for (final Object node2 : nodes) { final Node node1 = (Node) node2; final String error = null != node1.selectSingleNode("error") ? node1.selectSingleNode("error").getStringValue() : "Skipped"; final IStoredJobLoadResult storedJobLoadResult = parseStoredJobResult(node1, true, true, error); resultList.add(storedJobLoadResult); } } return resultList; }
public Collection<IStoredJob> listStoredJobs( final IStoredJobsQuery iStoredJobsQuery, final OutputStream output) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); params.put("xmlreq", "true"); final String nameMatch = iStoredJobsQuery.getNameMatch(); String groupMatch = iStoredJobsQuery.getGroupMatch(); final String projectFilter = iStoredJobsQuery.getProjectFilter(); final String commandFilter = iStoredJobsQuery.getCommand(); final String idlistFilter = iStoredJobsQuery.getIdlist(); final String typeFilter = iStoredJobsQuery.getType(); final String resourceFilter = iStoredJobsQuery.getResource(); if (null != nameMatch) { params.put("jobFilter", nameMatch); } if (null != groupMatch) { final Matcher matcher = Pattern.compile("^/*(.+?)/*$").matcher(groupMatch); if (matcher.matches()) { // strip leading and trailing slashes groupMatch = matcher.group(1); } params.put("groupPath", groupMatch); } if (null != projectFilter) { params.put("projFilter", projectFilter); } if (null != resourceFilter) { params.put("objFilter", resourceFilter); } if (null != typeFilter) { params.put("typeFilter", typeFilter); } if (null != commandFilter) { params.put("cmdFilter", commandFilter); } if (null != idlistFilter) { params.put("idlist", idlistFilter); } params.put("xmlreq", "true"); // 2. send request via ServerService final WebserviceResponse response; try { response = serverService.makeRundeckRequest(RUNDECK_LIST_STORED_JOBS_PATH, params, null, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } validateJobsResponse(response); //////////////////// // parse result list of queued items, return the collection of QueuedItems /////////////////// final Document resultDoc = response.getResultDoc(); final Node node = resultDoc.selectSingleNode("/joblist"); final ArrayList<IStoredJob> list = new ArrayList<IStoredJob>(); if (null == node) { return list; } final List items = node.selectNodes("job"); if (null != items && items.size() > 0) { for (final Object o : items) { final Node node1 = (Node) o; final String id = node1.selectSingleNode("id").getStringValue(); final String name = node1.selectSingleNode("name").getStringValue(); final String url = createJobURL(id); final Node gnode = node1.selectSingleNode("group"); final String group = null != gnode ? gnode.getStringValue() : null; final String description = node1.selectSingleNode("description").getStringValue(); list.add(StoredJobImpl.create(id, name, url, group, description)); } } if (null != output) { // write output doc to the outputstream final OutputFormat format = OutputFormat.createPrettyPrint(); try { final XMLWriter writer = new XMLWriter(output, format); writer.write(resultDoc); writer.flush(); } catch (IOException e) { throw new CentralDispatcherServerRequestException(e); } } return list; }
/** * Submit a request to the server which expects a list of queued item results in the response, and * return a single QueuedItemResult parsed from the response. * * @param tempxml xml temp file (or null) * @param otherparams parameters for the request * @param requestPath * @return a single QueuedItemResult * @throws CentralDispatcherException if an error occurs */ private QueuedItemResult submitQueueRequest( final File tempxml, final HashMap<String, String> otherparams, final String requestPath) throws CentralDispatcherException { final HashMap<String, String> params = new HashMap<String, String>(); params.put("xmlreq", "true"); if (null != otherparams) { params.putAll(otherparams); } final WebserviceResponse response; try { response = serverService.makeRundeckRequest(requestPath, params, tempxml, null); } catch (MalformedURLException e) { throw new CentralDispatcherServerRequestException("Failed to make request", e); } validateResponse(response); //////////////////// // parse result list of execution responses. this implementation handles multiple responses, // but only // returns a single QueuedItem (the first one found). // TODO: update to return multiple QueuedItems when multiple job queue requests are supported /////////////////// final Document resultDoc = response.getResultDoc(); final int succeeded; final int failed; Node node = resultDoc.selectSingleNode("/result/succeeded/@count"); if (null != node) { succeeded = Integer.parseInt(node.getStringValue()); } else { succeeded = -1; } node = resultDoc.selectSingleNode("/result/failed/@count"); if (null != node) { failed = Integer.parseInt(node.getStringValue()); } else { failed = -1; } final String succeededId; if (succeeded > 0) { logger.info("Succeeded queueing " + succeeded + " Job" + (succeeded > 1 ? "s" : "") + ":"); final List nodes = resultDoc.selectNodes("/result/succeeded/execution"); final Node node1 = (Node) nodes.iterator().next(); final String index = node1.selectSingleNode("@index").getStringValue(); final String id = node1.selectSingleNode("id").getStringValue(); succeededId = id; final String name = node1.selectSingleNode("name").getStringValue(); String url = node1.selectSingleNode("url").getStringValue(); url = makeAbsoluteURL(url); logger.info("\t" + index + ": " + name + " [" + id + "] <" + url + ">"); return QueuedItemResultImpl.successful("Succeeded queueing " + name, succeededId, url, name); } if (failed > 0) { final String s1 = "Failed to queue " + failed + " Job" + (failed > 1 ? "s" : "") + ":"; logger.error(s1); final List nodes = resultDoc.selectNodes("/result/failed/execution"); final Node node1 = (Node) nodes.iterator().next(); final String index = node1.selectSingleNode("@index").getStringValue(); final String id = null != node1.selectSingleNode("id") ? node1.selectSingleNode("id").getStringValue() : null; String url = null != node1.selectSingleNode("url") ? node1.selectSingleNode("url").getStringValue() : null; url = makeAbsoluteURL(url); final String error = null != node1.selectSingleNode("error") ? node1.selectSingleNode("error").getStringValue() : null; final String message = null != node1.selectSingleNode("message") ? node1.selectSingleNode("message").getStringValue() : null; final String errmsg = error + (null != id ? " [" + id + "] <" + url + ">" : "") + (null != message ? " : " + message : ""); final String s2 = index + ": " + errmsg; logger.error(s2); return QueuedItemResultImpl.failed(errmsg); } return QueuedItemResultImpl.failed("Server response contained no success information."); }
/** * Método que realiza todo el proceso de transformación del xml en la lista de criterios * * @param xml XML con la informacion de criterios * @return Listado con la informacion de los criterios {@see CriterioFechaVO} */ public List transform(String xml) { List criterios = new ArrayList(); FechaVO fechaInicial = null; FechaVO fechaFinal = null; CriterioFechaVO criterio = null; SAXReader saxReader = new SAXReader(); Document udocInfo = null; if (xml != null && xml.trim().length() > 0) { try { udocInfo = saxReader.read(new StringReader(xml.toString())); } catch (DocumentException e) { logger.error( "Se ha producido un error generando el reader para los criterios de la eliminacion"); throw new ArchivoModelException( e, "transform", "Error generando el reader para los criterios de la eliminacion"); } List condiciones = udocInfo.selectNodes("/Criterios_Busqueda/Condiciones_Fechas_Extremas/Condicion"); for (Iterator iter = condiciones.iterator(); iter.hasNext(); ) { Node condicion = (Node) iter.next(); Node operador = condicion.selectSingleNode("Fecha_Inicial/Operador"); Node valor = condicion.selectSingleNode("Fecha_Inicial/Valor"); if (valor != null && valor.getStringValue() != null && valor.getStringValue().length() > 0) { fechaInicial = new FechaVO(); fechaInicial.setOperador(operador.getStringValue()); StringOwnTokenizer st = new StringOwnTokenizer(valor.getStringValue(), "/"); fechaInicial.setMes(st.nextToken()); fechaInicial.setDia(st.nextToken()); } Node operadorFinal = condicion.selectSingleNode("Fecha_Final/Operador"); Node valorFinal = condicion.selectSingleNode("Fecha_Final/Valor"); if (valorFinal != null && valorFinal.getStringValue() != null && valorFinal.getStringValue().length() > 0) { fechaFinal = new FechaVO(); fechaFinal.setOperador(operadorFinal.getStringValue()); StringOwnTokenizer st = new StringOwnTokenizer(valorFinal.getStringValue(), "/"); fechaFinal.setMes(st.nextToken()); fechaFinal.setDia(st.nextToken()); } // Creamos el criterio con las fechas criterio = new CriterioFechaVO(dbEngine); criterio.setFechaFinal(fechaFinal); criterio.setFechaInicial(fechaInicial); try { criterio.setId(GuidManager.generateGUID(dbEngine)); } catch (Exception e) { logger.error("Se ha producido un error generando el identificador para el criterio"); throw new ArchivoModelException( e, "transform", "Error generando el identificador para el criterio"); } // Añadimos el criterio a la listas criterios.add(criterio); } } return criterios; }