List of usage examples for java.util Set toArray
<T> T[] toArray(T[] a);
From source file:com.jaspersoft.jasperserver.search.service.impl.ResourceServiceImpl.java
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) public void copy(Set<String> resourceUris, String destinationFolderUri) { Map<String, Resource> resourceMap = getResourceMap(resourceUris); if (!isLabelsUnique(resourceMap)) { throw new JSException("jsexception.search.duplicate.label", new Object[] { "", destinationFolderUri }); }/*from ww w. jav a 2 s . co m*/ ensureObjectLabelsNew(destinationFolderUri, getLabels(resourceMap)); while (getResourcesWithUniqueName(resourceMap).size() > 0) { Map<String, Resource> resources = getResourcesWithUniqueName(resourceMap); Set<String> uris = resources.keySet(); repositoryService.copyResources(null, uris.toArray(new String[uris.size()]), destinationFolderUri); for (String key : resources.keySet()) { resourceMap.remove(key); } } }
From source file:org.ednovo.gooru.controller.ResourceCassandraRestController.java
public void executeEveryTenSecs() throws Exception { Set<String> domainKeysSet = resourceCassandraService .getAllRedisKeys(resourceCassandraService.getConfigSettings(ConfigSettings.DOMAIN_KEY) + "*"); if (domainKeysSet != null && domainKeysSet.size() > 0) { String[] domainKeys = domainKeysSet.toArray(new String[0]); ForkJoinPool fjpool = new ForkJoinPool(64); logger.info("Start Time for RecurssiveAction : " + (System.currentTimeMillis())); JobsRecurssiveAction task = new JobsRecurssiveAction(domainKeys, 1, domainKeys.length, resourceCassandraService); long start = System.currentTimeMillis(); fjpool.invoke(task);/* w w w . ja v a 2 s .c om*/ logger.info("End Time for RecurssiveAction : " + (System.currentTimeMillis())); logger.info("Parallel processing time: " + (System.currentTimeMillis() - start) + " ms"); } }
From source file:biz.netcentric.cq.tools.actool.aceservicejmx.impl.AceServiceMBeanImpl.java
@Override public String[] getConfigurationFiles() { final Set<String> paths = aceService.getCurrentConfigurationPaths(); StringBuilder sb = new StringBuilder(); int cnt = 1;/*from w w w . j a va 2 s.c o m*/ for (String path : paths) { sb.append(cnt + ". " + path + " \n"); cnt++; } return paths.toArray(new String[paths.size()]); }
From source file:de.tudarmstadt.ukp.dkpro.bigdata.io.hadoop.HdfsResourceLoader.java
protected Resource[] findPathMatchingResources(String locationPattern) throws IOException { // replace ~/ shortcut if (locationPattern.startsWith("~/")) { locationPattern = locationPattern.substring(2); }// w ww . j a v a 2s .co m String rootDirPath = determineRootDir(locationPattern); final String subPattern = locationPattern.substring(rootDirPath.length()); if (rootDirPath.isEmpty()) { rootDirPath = "."; } final Resource rootDirResource = getResource(rootDirPath); final Set<Resource> result = new LinkedHashSet<Resource>(16); result.addAll(doFindPathMatchingPathResources(rootDirResource, subPattern)); return result.toArray(new Resource[result.size()]); }
From source file:com.ryan.ryanreader.jsonwrap.JsonBufferedObject.java
@Override protected void prettyPrint(final int indent, final StringBuilder sb) throws InterruptedException, IOException { if (join() != Status.LOADED) { throwFailReasonException();//from ww w . ja v a 2s. c o m } sb.append('{'); final Set<String> propertyKeySet = properties.keySet(); final String[] fieldNames = propertyKeySet.toArray(new String[propertyKeySet.size()]); for (int prop = 0; prop < fieldNames.length; prop++) { if (prop != 0) sb.append(','); sb.append('\n'); for (int i = 0; i < indent + 1; i++) sb.append(" "); sb.append("\"").append(fieldNames[prop].replace("\\", "\\\\").replace("\"", "\\\"")).append("\": "); properties.get(fieldNames[prop]).prettyPrint(indent + 1, sb); } sb.append('\n'); for (int i = 0; i < indent; i++) sb.append(" "); sb.append('}'); }
From source file:eu.udig.style.advanced.utils.Utilities.java
/** * Getter for an array of all available marks. * // w ww .j av a2 s . c o m * @return all mark names (for gui use). */ public static String[] getAllMarksArray() { Set<String> keySet = markNamesToDef.keySet(); return (String[]) keySet.toArray(new String[keySet.size()]); }
From source file:org.quantumbadger.redreader.jsonwrap.JsonBufferedObject.java
@Override protected void prettyPrint(final int indent, final StringBuilder sb) throws InterruptedException, IOException { if (join() != STATUS_LOADED) { throwFailReasonException();/*from w ww . j ava 2s. c om*/ } sb.append('{'); final Set<String> propertyKeySet = properties.keySet(); final String[] fieldNames = propertyKeySet.toArray(new String[propertyKeySet.size()]); for (int prop = 0; prop < fieldNames.length; prop++) { if (prop != 0) sb.append(','); sb.append('\n'); for (int i = 0; i < indent + 1; i++) sb.append(" "); sb.append("\"").append(fieldNames[prop].replace("\\", "\\\\").replace("\"", "\\\"")).append("\": "); properties.get(fieldNames[prop]).prettyPrint(indent + 1, sb); } sb.append('\n'); for (int i = 0; i < indent; i++) sb.append(" "); sb.append('}'); }
From source file:com.soulgalore.velocity.MergeXMLWithVelocity.java
void create(String[] args) throws JDOMException, IOException { Set<String> xmls = new HashSet<String>(); if (args.length > 4) { for (int i = 4; i < args.length; i++) { xmls.add(args[i]);//from ww w.ja v a2s.c o m } } String result = (args.length > 4) ? merge(args[0], args[1], xmls.toArray(new String[0])) : merge(args[0], args[1]); final PrintWriter out = new PrintWriter(new FileOutputStream(args[3])); out.write(result); out.close(); }
From source file:hoot.services.controllers.osm.OSMTestUtils.java
static Set<Long> createTestWays(long changesetId, Set<Long> nodeIds) throws Exception { Long[] nodeIdsArr = nodeIds.toArray(new Long[nodeIds.size()]); Map<String, String> tags = new HashMap<>(); tags.put("key 1", "val 1"); tags.put("key 2", "val 2"); List<Long> wayNodeIds = new ArrayList<>(); wayNodeIds.add(nodeIdsArr[0]);// w ww . ja v a2s . c o m wayNodeIds.add(nodeIdsArr[1]); wayNodeIds.add(nodeIdsArr[4]); Set<Long> wayIds = new LinkedHashSet<>(); wayIds.add(insertNewWay(changesetId, getMapId(), wayNodeIds, tags)); tags.clear(); wayNodeIds.clear(); wayNodeIds.add(nodeIdsArr[2]); wayNodeIds.add(nodeIdsArr[1]); wayIds.add(insertNewWay(changesetId, getMapId(), wayNodeIds, null)); wayNodeIds.clear(); tags.put("key 3", "val 3"); wayNodeIds.add(nodeIdsArr[0]); wayNodeIds.add(nodeIdsArr[1]); wayIds.add(insertNewWay(changesetId, getMapId(), wayNodeIds, tags)); tags.clear(); wayNodeIds.clear(); return wayIds; }
From source file:hoot.services.controllers.osm.OSMTestUtils.java
static Set<Long> createTestRelationsNoWays(long changesetId, Set<Long> nodeIds) throws Exception { Long[] nodeIdsArr = nodeIds.toArray(new Long[nodeIds.size()]); List<RelationMember> members = new ArrayList<>(); members.add(new RelationMember(nodeIdsArr[0], ElementType.Node, "role1")); members.add(new RelationMember(nodeIdsArr[2], ElementType.Node)); Map<String, String> tags = new HashMap<>(); tags.put("key 1", "val 1"); long firstRelationId = insertNewRelation(changesetId, getMapId(), members, tags); Set<Long> relationIds = new LinkedHashSet<>(); relationIds.add(firstRelationId);// w w w . j ava 2s . co m tags.clear(); members.clear(); tags.put("key 2", "val 2"); tags.put("key 3", "val 3"); members.add(new RelationMember(nodeIdsArr[4], ElementType.Node, "role1")); members.add(new RelationMember(firstRelationId, ElementType.Relation, "role1")); relationIds.add(insertNewRelation(changesetId, getMapId(), members, tags)); tags.clear(); members.clear(); tags.put("key 4", "val 4"); members.add(new RelationMember(nodeIdsArr[2], ElementType.Node, "role1")); relationIds.add(insertNewRelation(changesetId, getMapId(), members, tags)); tags.clear(); members.clear(); return relationIds; }