List of usage examples for org.apache.commons.lang StringUtils upperCase
public static String upperCase(String str)
Converts a String to upper case as per String#toUpperCase() .
From source file:org.orcid.persistence.dao.impl.ProfileDaoImpl.java
@Override @Transactional//from ww w. ja v a2 s. c om public void updateBiography(String orcid, String biography, Visibility visibility) { Query updateQuery = entityManager.createQuery( "update ProfileEntity set lastModified = now(), biography = :biography, biography_visibility = :visibility where orcid = :orcid"); updateQuery.setParameter("orcid", orcid); updateQuery.setParameter("biography", biography); updateQuery.setParameter("visibility", visibility == null ? null : StringUtils.upperCase(visibility.value())); updateQuery.executeUpdate(); }
From source file:org.orcid.persistence.dao.impl.ProfileDaoImpl.java
@Override @Transactional/* w w w. j a va 2 s.co m*/ public void updateNames(String orcid, String givenNames, String familyName, String creditName, Visibility creditNameVisibility) { Query updateQuery = entityManager.createQuery( "update ProfileEntity set lastModified = now(), family_name = :familyName, given_names = :givenNames, credit_name = :creditName, names_visibility=:creditNameVisibility where orcid = :orcid"); updateQuery.setParameter("orcid", orcid); updateQuery.setParameter("givenNames", givenNames); updateQuery.setParameter("familyName", familyName); updateQuery.setParameter("creditName", creditName); updateQuery.setParameter("creditNameVisibility", creditNameVisibility == null ? null : StringUtils.upperCase(creditNameVisibility.value())); updateQuery.executeUpdate(); }
From source file:org.orcid.persistence.dao.impl.ProfileDaoImpl.java
@Override @Transactional/*w ww.j a va 2s. c o m*/ public boolean updateResearcherUrlsVisibility(String orcid, Visibility visibility) { Query query = entityManager.createNativeQuery( "update profile set last_modified=now(), researcher_urls_visibility=:researcher_urls_visibility, indexing_status='PENDING' where orcid=:orcid"); query.setParameter("researcher_urls_visibility", StringUtils.upperCase(visibility.value())); query.setParameter("orcid", orcid); boolean result = query.executeUpdate() > 0 ? true : false; return result; }
From source file:org.orcid.persistence.dao.impl.ProfileKeywordDaoImpl.java
@Override @Transactional//from w w w.ja v a2 s.co m public boolean updateKeywordsVisibility(String orcid, Visibility visibility) { Query query = entityManager.createNativeQuery( "update profile set last_modified=now(), keywords_visibility=:keywords_visibility, indexing_status='PENDING' where orcid=:orcid"); query.setParameter("keywords_visibility", StringUtils.upperCase(visibility.value())); query.setParameter("orcid", orcid); boolean result = query.executeUpdate() > 0 ? true : false; return result; }
From source file:org.rundeck.api.parser.AbortParser.java
@Override public RundeckAbort parse(Node abortNode) { RundeckAbort abort = new RundeckAbort(); try {/*from ww w . j a v a 2s .co m*/ abort.setStatus(AbortStatus.valueOf(StringUtils.upperCase(abortNode.valueOf("@status")))); } catch (IllegalArgumentException e) { abort.setStatus(null); } Node execNode = abortNode.selectSingleNode("execution"); if (execNode != null) { RundeckExecution execution = new ExecutionParser().parseXmlNode(execNode); abort.setExecution(execution); } return abort; }
From source file:org.rundeck.api.parser.EventParser.java
@Override public RundeckEvent parse(Node eventNode) { RundeckEvent event = new RundeckEvent(); event.setTitle(StringUtils.trimToNull(eventNode.valueOf("title"))); try {//from w w w . j av a2s.co m event.setStatus(EventStatus.valueOf(StringUtils.upperCase(eventNode.valueOf("status")))); } catch (IllegalArgumentException e) { event.setStatus(null); } event.setSummary(StringUtils.trimToNull(eventNode.valueOf("summary"))); NodeSummary nodeSummary = new NodeSummary(); nodeSummary.setSucceeded(Integer.valueOf(eventNode.valueOf("node-summary/@succeeded"))); nodeSummary.setFailed(Integer.valueOf(eventNode.valueOf("node-summary/@failed"))); nodeSummary.setTotal(Integer.valueOf(eventNode.valueOf("node-summary/@total"))); event.setNodeSummary(nodeSummary); event.setUser(StringUtils.trimToNull(eventNode.valueOf("user"))); event.setProject(StringUtils.trimToNull(eventNode.valueOf("project"))); String startedAt = StringUtils.trimToNull(eventNode.valueOf("@starttime")); if (startedAt != null) { event.setStartedAt(new Date(Long.valueOf(startedAt))); } String endedAt = StringUtils.trimToNull(eventNode.valueOf("@endtime")); if (endedAt != null) { event.setEndedAt(new Date(Long.valueOf(endedAt))); } event.setAbortedBy(StringUtils.trimToNull(eventNode.valueOf("abortedby"))); try { event.setExecutionId(Long.valueOf(eventNode.valueOf("execution/@id"))); } catch (NumberFormatException e) { event.setExecutionId(null); } event.setJobId(StringUtils.trimToNull(eventNode.valueOf("job/@id"))); return event; }
From source file:org.rundeck.api.parser.ExecutionParser.java
@Override public RundeckExecution parse(Node execNode) { RundeckExecution execution = new RundeckExecution(); execution.setId(Long.valueOf(execNode.valueOf("@id"))); execution.setUrl(StringUtils.trimToNull(execNode.valueOf("@href"))); try {/*from w w w.ja va 2 s . c o m*/ execution.setStatus(ExecutionStatus .valueOf(StringUtils.replace(StringUtils.upperCase(execNode.valueOf("@status")), "-", "_"))); } catch (IllegalArgumentException e) { execution.setStatus(null); } execution.setDescription(StringUtils.trimToNull(execNode.valueOf("description"))); execution.setArgstring(StringUtils.trimToNull(execNode.valueOf("argstring"))); execution.setStartedBy(StringUtils.trimToNull(execNode.valueOf("user"))); execution.setAbortedBy(StringUtils.trimToNull(execNode.valueOf("abortedby"))); execution.setProject(StringUtils.trimToNull(execNode.valueOf("@project"))); String startedAt = StringUtils.trimToNull(execNode.valueOf("date-started/@unixtime")); if (startedAt != null) { execution.setStartedAt(new Date(Long.valueOf(startedAt))); } String endedAt = StringUtils.trimToNull(execNode.valueOf("date-ended/@unixtime")); if (endedAt != null) { execution.setEndedAt(new Date(Long.valueOf(endedAt))); } Node jobNode = execNode.selectSingleNode("job"); if (jobNode != null) { RundeckJob job = new JobParser().parseXmlNode(jobNode); execution.setJob(job); } final Node successfulNodes = execNode.selectSingleNode("successfulNodes"); if (successfulNodes != null) { final List<RundeckNode> rundeckNodes = new ListParser<RundeckNode>(new NodeParser(), "successfulNodes/node").parseXmlNode(execNode); execution.setSuccessfulNodes(new HashSet<RundeckNodeIdentity>(rundeckNodes)); } else { execution.setSuccessfulNodes(Collections.<RundeckNodeIdentity>emptySet()); } final Node failedNodes = execNode.selectSingleNode("failedNodes"); if (failedNodes != null) { final List<RundeckNode> rundeckNodes = new ListParser<RundeckNode>(new NodeParser(), "failedNodes/node") .parseXmlNode(execNode); execution.setFailedNodes(new HashSet<RundeckNodeIdentity>(rundeckNodes)); } else { execution.setFailedNodes(Collections.<RundeckNodeIdentity>emptySet()); } return execution; }
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definitions of all jobs that belongs to the given project * * @param filename path of the file where the content should be saved - mandatory * @param format of the export. See {@link FileType} - mandatory * @param project name of the project - mandatory * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is * invalid/*from ww w . j a va 2 s . com*/ * @throws IOException if we failed to write to the file * @see #exportJobsToFile(String, FileType, String, String, String, String...) * @see #exportJobs(String, String) */ public void exportJobsToFile(String filename, String format, String project) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { AssertUtil.notBlank(format, "format is mandatory to export jobs !"); exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project); }
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, * groupPath and jobIds)// ww w .j ava 2 s . c o m * * @param filename path of the file where the content should be saved - mandatory * @param format of the export. See {@link FileType} - mandatory * @param project name of the project - mandatory * @param jobFilter a filter for the job Name - optional * @param groupPath a group or partial group path to include all jobs within that group path - optional * @param jobIds a list of Job IDs to include - optional * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the filename, format or project is blank (null, empty or whitespace), or the * format is invalid * @throws IOException if we failed to write to the file * @see #exportJobsToFile(String, FileType, String, String, String, String...) * @see #exportJobs(FileType, String, String, String, String...) */ public void exportJobsToFile(String filename, String format, String project, String jobFilter, String groupPath, String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { AssertUtil.notBlank(format, "format is mandatory to export jobs !"); exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds); }
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definitions of all jobs that belongs to the given project * * @param format of the export. See {@link FileType} - mandatory * @param project name of the project - mandatory * @return an {@link InputStream} instance, not linked to any network resources - won't be null * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is * invalid//from w ww . j av a 2 s . c o m * @see #exportJobs(FileType, String, String, String, String...) * @see #exportJobsToFile(String, String, String) */ public InputStream exportJobs(String format, String project) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { AssertUtil.notBlank(format, "format is mandatory to export jobs !"); return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project); }