List of usage examples for java.util Collection toString
public String toString()
From source file:org.apache.usergrid.apm.service.SessionDBServiceImpl.java
@SuppressWarnings("unchecked") @Override/*from www.jav a2 s .c o m*/ public List<SummarySessionMetrics> getSummarySessionsBySessionId(Long appId, Collection<String> sessionIds) throws HibernateException { // TODO Auto-generated method stub log.info("getting summary sessions matching " + sessionIds.toString()); String queryString = "FROM SummarySessionMetrics m where m.appId = :appId and m.sessionId in (:sessions) "; List<SummarySessionMetrics> metrics = null; Session session = null; Transaction transaction = null; try { session = ServiceFactory.getAnalyticsHibernateSession(); transaction = session.beginTransaction(); Query query = session.createQuery(queryString); query.setParameter("appId", appId); query.setParameterList("sessions", sessionIds); metrics = query.list(); transaction.commit(); } catch (Exception e) { e.printStackTrace(); transaction.rollback(); throw new HibernateException("Cannot get metrics from Summary SessionMetrics ", e); } return metrics; }
From source file:com.strider.datadefender.DatabaseAnonymizer.java
/** * Creates the UPDATE query for a single row of results. * /* ww w . j a v a2s. co m*/ * @param table * @param columns * @param keys * @param updatableKeys * @return the SQL statement */ private String getUpdateQuery(final Table table, final Collection<String> updateColumns, final Collection<String> keys) { final StringBuilder sql = new StringBuilder(); sql.append("UPDATE ").append(table.getName()).append(" SET ") .append(StringUtils.join(updateColumns, " = ?, ")).append(" = ? WHERE "); log.info("keys: " + keys.toString()); int iteration = 0; final int collectionSize = keys.size(); final StringBuilder whereStmtp = new StringBuilder(); for (final String key : keys) { ++iteration; whereStmtp.append(key).append(" = ? "); if (collectionSize > iteration) { whereStmtp.append(AND); } } sql.append(whereStmtp); log.debug("getUpdateQuery: " + sql.toString()); return sql.toString(); }
From source file:org.orbeon.oxf.processor.pipeline.choose.AbstractChooseProcessor.java
public Processor createInstance() { // We store here the "refs with no id" and "ids with no ref" for each branch. // Those are list of collections (one collection for each branch). final List refsWithNoId = new ArrayList(); final List idsWithNoRef = new ArrayList(); final List paramRefs = new ArrayList(); for (Iterator astIterator = chooseAST.getWhen().iterator(); astIterator.hasNext();) { // Get info about id used in this branch final ASTWhen when = (ASTWhen) astIterator.next(); IdInfo idInfo = when.getIdInfo(); paramRefs.add(idInfo.getOutputRefs()); // Determine all <p:input ref="..."> with no <p:output id="...">. // Those are the inputs of this processor. final Set branchRefsWithNoId = new HashSet(idInfo.getInputRefs()); branchRefsWithNoId.removeAll(idInfo.getOutputIds()); refsWithNoId.add(branchRefsWithNoId); // Determine all <p:output id="..."> with no <p:input ref="...">. // Those are the outputs of this processor. final Set branchIdsWithNoRef = new HashSet(idInfo.getOutputIds()); branchIdsWithNoRef.removeAll(idInfo.getInputRefs()); idsWithNoRef.add(branchIdsWithNoRef); }/*from ww w. ja v a 2 s.c o m*/ // Make sure that the "ids with no ref" are the same for each branch if (idsWithNoRef.size() > 1) { final Collection firstBranchIdsWithNoRef = (Collection) idsWithNoRef.get(0); int branchId = 0; for (Iterator i = idsWithNoRef.iterator(); i.hasNext();) { branchId++; final Collection branchIdsWithNoRef = (Collection) i.next(); if (branchIdsWithNoRef != firstBranchIdsWithNoRef && !CollectionUtils.isEqualCollection(branchIdsWithNoRef, firstBranchIdsWithNoRef)) throw new ValidationException("ASTChoose branch number " + branchId + " does not declare the same ids " + branchIdsWithNoRef.toString() + " as the previous branches " + firstBranchIdsWithNoRef.toString(), getLocationData()); } } // Make sure that the "param ref" are the same for each branch if (paramRefs.size() > 1) { final Collection firstBranchParamRefs = (Collection) paramRefs.get(0); int branchId = 0; for (Iterator i = paramRefs.iterator(); i.hasNext();) { branchId++; final Collection branchParamRefs = (Collection) i.next(); if (branchParamRefs != firstBranchParamRefs && !CollectionUtils.isEqualCollection(branchParamRefs, firstBranchParamRefs)) throw new ValidationException("ASTChoose branch number " + branchId + " does not declare the same refs " + branchParamRefs.toString() + " as the previous branches " + firstBranchParamRefs.toString(), getLocationData()); } } // Compute the union of "refs with no id" for all the branches final Set allRefsWithNoId = new HashSet(); for (Iterator i = refsWithNoId.iterator(); i.hasNext();) allRefsWithNoId.addAll((Set) i.next()); // Create the list of inputs based on allRefsWithNoId final List astParams = new ArrayList(); for (int i = 0; i < 2; i++) { final Set parameters; if (i == 0) { parameters = allRefsWithNoId; } else { parameters = new HashSet(); parameters.addAll((Set) idsWithNoRef.get(0)); parameters.addAll((Set) paramRefs.get(0)); } for (Iterator j = parameters.iterator(); j.hasNext();) { final String paramName = (String) j.next(); ASTParam astParam = new ASTParam(); astParam.setType(i == 0 ? ASTParam.INPUT : ASTParam.OUTPUT); astParam.setName(paramName); astParams.add(astParam); } } // For each branch, create a new pipeline processor final List<Processor> branchProcessors = new ArrayList(); final List branchConditions = new ArrayList(); final List<NamespaceMapping> branchNamespaces = new ArrayList<NamespaceMapping>(); for (Iterator astIterator = chooseAST.getWhen().iterator(); astIterator.hasNext();) { final ASTWhen astWhen = (ASTWhen) astIterator.next(); // Save condition branchConditions.add(astWhen.getTest()); // Get namespaces declared at this point in the pipeline if (astWhen.getNode() != null && astWhen.getNamespaces().mapping.size() != 0) { throw new ValidationException("ASTWhen cannot have both a node and namespaces defined", astWhen.getLocationData()); } branchNamespaces.add(astWhen.getNode() != null ? new NamespaceMapping(Dom4jUtils.getNamespaceContextNoDefault((Element) astWhen.getNode())) : astWhen.getNamespaces()); // Add an identity processor to connect the output of the branch to // the <param type="output"> of the pipeline final Set idsToConvert = (Set) idsWithNoRef.get(0); for (Iterator i = idsToConvert.iterator(); i.hasNext();) { final String id = (String) i.next(); final ASTProcessorCall identityConnector = new ASTProcessorCall( XMLConstants.IDENTITY_PROCESSOR_QNAME); { identityConnector.addInput(new ASTInput("data", new ASTHrefId(new ASTOutput(null, id)))); final ASTParam outParam = new ASTParam(ASTParam.OUTPUT, id); final LocationData locDat = Dom4jUtils.getLocationData(); final ASTOutput astOut = new ASTOutput("data", outParam); astOut.setLocationData(locDat); identityConnector.addOutput(astOut); } astWhen.addStatement(identityConnector); } final ASTPipeline astPipeline = new ASTPipeline(); astPipeline.setValidity(validity); astPipeline.getParams().addAll(astParams); astPipeline.getStatements().addAll(astWhen.getStatements()); astPipeline.setNode(astWhen.getNode()); final Processor pipelineProcessor = new PipelineProcessor(astPipeline); if (getId() != null) pipelineProcessor.setId(getId() + "-branch" + branchProcessors.size()); branchProcessors.add(pipelineProcessor); } return new ConcreteChooseProcessor(getId(), getLocationData(), branchConditions, branchNamespaces, branchProcessors, allRefsWithNoId, (Set) idsWithNoRef.get(0), (Set) paramRefs.get(0)); }
From source file:com.googlecode.l10nmavenplugin.validators.property.SpellCheckValidator.java
/** * WARN in case of spellcheck error using property locale. *///w ww . ja va 2s. c o m public int validate(Property property, List<L10nReportItem> reportItems) { Locale locale = property.getLocale(); if (locale == null) { // Case of root bundle locale = Locale.ENGLISH; } SpellChecker spellChecker = spellCheckerLocaleRepository.getSpellChecker(locale); if (spellChecker != null) { ListSpellCheckErrorListener listener = new ListSpellCheckErrorListener(spellChecker); spellChecker.addSpellCheckListener(listener); String message = property.getMessage(); spellChecker.checkSpelling(new StringWordTokenizer(message)); Collection<SpellCheckError> errors = listener.getSpellCheckErrors(); // The message with errors replaced by suggestions String correction = message; // Start from last errors, so that error position remains valid SpellCheckError[] errs = errors.toArray(new SpellCheckError[errors.size()]); for (int i = errs.length - 1; i >= 0; i--) { SpellCheckError error = errs[i]; if (error.getSuggestion() != null) { int pos = error.getPosition(); correction = StringUtils.overlay(correction, error.getSuggestion(), pos, pos + error.getError().length()); } } if (errors.size() > 0) { StringBuffer sb = new StringBuffer(); sb.append("Spellcheck error on word(s): ").append(errors.toString()).append(" and locale <") .append(locale).append(">."); if (correction != null) { sb.append(" Suggested correction: [").append(correction).append("]"); } L10nReportItem reportItem = new L10nReportItem(Type.SPELLCHECK, sb.toString(), property, null); reportItems.add(reportItem); logger.log(reportItem); } spellChecker.removeSpellCheckListener(listener); } return 0; }
From source file:net.solarnetwork.node.job.DatumDataSourceLoggerJob.java
@Override protected void executeInternal(JobExecutionContext jobContext) throws Exception { for (DatumDataSource<T> datumDataSource : datumDataSources) { try {//from www. j a va 2 s. co m if (log.isDebugEnabled()) { log.debug("Collecting [{}] from [{}]", datumDataSource.getDatumType().getSimpleName(), datumDataSource); } Collection<T> datumList = null; if (datumDataSource instanceof MultiDatumDataSource<?>) { datumList = readMultiDatum(datumDataSource); } if (datumList == null) { T datum = datumDataSource.readCurrentDatum(); if (datum != null) { datumList = new LinkedList<T>(); datumList.add(datum); } } if (datumList == null || datumList.isEmpty()) { if (log.isInfoEnabled()) { log.info("No data returned from [{}]", datumDataSource); } continue; } if (log.isInfoEnabled()) { log.info("Got Datum to persist: {}", (datumList.size() == 1 ? datumList.iterator().next().toString() : datumList.toString())); } for (T datum : datumList) { try { datumDao.storeDatum(datum); log.debug("Persisted Datum {}", datum); } catch (DuplicateKeyException e) { // we ignore duplicate key exceptions, as we sometimes collect the same // datum multiple times for redundancy log.info("Duplicate datum {}; not persisting", datum); } } } catch (Throwable e) { logThrowable(e); } } }
From source file:org.silverpeas.components.websites.control.WebSiteSessionController.java
/** * dePublish//w w w.j a v a 2 s . c o m */ public synchronized void dePublish(Collection<String> listeSite) throws WebSitesException { try { getWebSiteService().dePublish(getComponentId(), listeSite); } catch (Exception re) { throw new WebSitesException("WebSiteSessionController.dePublish(listeSite)", SilverpeasException.ERROR, "webSites.EX_DEPUBLISH_SELECTED_FAILED", "listeSite =" + listeSite.toString(), re); } }
From source file:info.mikaelsvensson.devtools.sitesearch.PathUtilsTest.java
public void testTwoPaths(final String[] sourcePath, final String[] targetPath) { Collection<String> errors = new LinkedList<String>(); for (int i = 10; i < targetPath.length; i++) { String target = StringUtils.join(targetPath, '\\', 0, i + 1); for (int j = 10; j < sourcePath.length; j++) { String source = StringUtils.join(sourcePath, '\\', 0, j + 1); System.out.println(source); System.out.println(target); File sourceFile = new File(source); String relativePath = PathUtils.getRelativePath(sourceFile, new File(target)); System.out.println(relativePath); File sourceFolder = sourceFile.isDirectory() ? sourceFile : sourceFile.getParentFile(); File actual = new File(sourceFolder, relativePath.replace(PathUtils.SEP, File.separatorChar)); File expected = new File(target); boolean isEqual = actual.toURI().normalize().equals(expected.toURI().normalize()); if (!isEqual) { errors.add("The path from " + source + " to " + target + " is NOT " + actual); }/* ww w . j a v a 2 s.com*/ } } assertTrue(errors.toString(), errors.size() == 0); }
From source file:org.silverpeas.components.websites.control.WebSiteSessionController.java
/** * publish/*from w w w . j av a 2s . co m*/ */ public synchronized void publish(Collection<String> listeSite) throws WebSitesException { /* Collection d'id de site */ try { getWebSiteService().publish(getComponentId(), listeSite); } catch (Exception re) { throw new WebSitesException("WebSiteSessionController.publish(listeSite)", SilverpeasException.ERROR, "webSites.EX_PUBLISH_SELECTED_FAILED", "listeSite =" + listeSite.toString(), re); } }
From source file:com.netflix.spinnaker.clouddriver.ecs.provider.agent.ServiceCachingAgent.java
@Override protected Map<String, Collection<CacheData>> generateFreshData(Collection<Service> services) { Collection<CacheData> dataPoints = new LinkedList<>(); Map<String, CacheData> clusterDataPoints = new HashMap<>(); for (Service service : services) { Map<String, Object> attributes = convertServiceToAttributes(accountName, region, service); String key = Keys.getServiceKey(accountName, region, service.getServiceName()); dataPoints.add(new DefaultCacheData(key, attributes, Collections.emptyMap())); Map<String, Object> clusterAttributes = EcsClusterCachingAgent .convertClusterArnToAttributes(accountName, region, service.getClusterArn()); String clusterName = StringUtils.substringAfterLast(service.getClusterArn(), "/"); key = Keys.getClusterKey(accountName, region, clusterName); clusterDataPoints.put(key, new DefaultCacheData(key, clusterAttributes, Collections.emptyMap())); }/* w w w .j a v a2 s . c o m*/ log.info("Caching " + dataPoints.size() + " services in " + getAgentType()); Map<String, Collection<CacheData>> dataMap = new HashMap<>(); dataMap.put(SERVICES.toString(), dataPoints); log.info("Caching " + clusterDataPoints.size() + " ECS clusters in " + getAgentType()); dataMap.put(ECS_CLUSTERS.toString(), clusterDataPoints.values()); return dataMap; }
From source file:org.seadva.archive.impl.cloud.SdaArchiveStore.java
public ResearchObject putResearchPackage(InputStream dcpStream) throws AIPFormatException { Sftp sftp = null;//from w w w. j a va 2s.co m String sipDirectory = null; try { sftp = new Sftp(this.hostname, this.username, this.password, this.mountPath); } catch (JSchException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } DcsModelBuilder modelBuilder = new SeadXstreamStaxModelBuilder(); useMount = false; ResearchObject pkg; try { pkg = (ResearchObject) modelBuilder.buildSip(dcpStream); } catch (InvalidXmlException e) { throw new AIPFormatException(e.getMessage()); } populateRelations(pkg); Collection<DcsDeliverableUnit> dus = pkg.getDeliverableUnits(); Collection<DcsFile> files = pkg.getFiles(); for (DcsDeliverableUnit du : dus) { Collection<DcsResourceIdentifier> alternateIds = null; if (du.getParents().isEmpty()) { alternateIds = du.getAlternateIds(); System.out.println("Alternate IDs: " + alternateIds.toString()); if (alternateIds != null) { DcsResourceIdentifier id = null; Iterator<DcsResourceIdentifier> idIt = alternateIds.iterator(); int alreadySet = 0; while (idIt.hasNext()) { id = idIt.next(); if (id.getTypeId().equalsIgnoreCase("storage_format")) { alreadySet = 1; } } if (alreadySet == 1) break; } else { alternateIds = new HashSet<DcsResourceIdentifier>(); } try { DcsResourceIdentifier storage_format = new DcsResourceIdentifier(); storage_format.setTypeId("storage_format"); if (isTar) storage_format.setIdValue("tar"); else storage_format.setIdValue("collection"); System.out.println("AlternateID: " + storage_format.toString()); alternateIds.add(storage_format); } catch (Exception e) { e.printStackTrace(); } du.setAlternateIds(alternateIds); } } pkg.setDeliverableUnits(dus); String sipSource = sipArchival(pkg); if (isTar) { System.out.println("###############################################################"); Collection<DcsDeliverableUnit> t_dus = pkg.getDeliverableUnits(); Collection<DcsFile> t_files = pkg.getFiles(); Map duMap = new HashMap(); Map fileMap = new HashMap(); for (DcsDeliverableUnit du : t_dus) { duMap.put(du.getId(), du); } for (DcsFile file : pkg.getFiles()) { fileMap.put(file.getId(), file); System.out.println("File name: " + file.getName() + " - " + file.getSource()); } for (DcsManifestation manifestation : pkg.getManifestations()) { if (duMap.containsKey(manifestation.getDeliverableUnit())) { for (DcsManifestationFile manifestationFile : manifestation.getManifestationFiles()) { DcsFile file = (DcsFile) fileMap.get(manifestationFile.getRef().getRef()); System.out.println("Manifestation file: " + file.getName()); } } } String t_sipDirectory = null; String tarFilePath = null; String tarFileName = null; String collectionName = null; for (DcsDeliverableUnit rootDu : rootDUs) { if (((SeadDeliverableUnit) rootDu).getPrimaryLocation().getLocation() == null) { System.out.println("Root Directory Name: " + rootDu.getTitle() + " - " + rootDu.getId()); t_sipDirectory = rootDu.getTitle(); try { if (sftp != null) { sftp.createDirectory(rootDu.getTitle()); } } catch (NullPointerException npe) { System.err.println("SFTP Directory creation failed!"); } } else { System.out.println("Root Directory Name: " + ((SeadDeliverableUnit) rootDu).getPrimaryLocation().getLocation() + " - " + rootDu.getId()); t_sipDirectory = ((SeadDeliverableUnit) rootDu).getPrimaryLocation().getLocation(); } //archive metadata files for (DcsMetadataRef metadataRef : rootDu.getMetadataRef()) { for (DcsFile file : t_files) { if (file.getId().equalsIgnoreCase(metadataRef.getRef())) { String fileName = file.getName(); System.out.println("Archive metadata filename: " + fileName); System.out.println(file.getSource()); System.out.println("DataLocation: " + t_sipDirectory + "/" + fileName); } } } String tmpDirectory = "/tmp/tarFileLocation/" + rootDu.getTitle() + "/" + rootDu.getTitle(); System.out.println("Collecting files to create a tar..."); collectTarFiles(rootDu.getId(), tmpDirectory); System.out.println("Creating the tar ..."); collectionName = rootDu.getTitle(); tarFileName = rootDu.getTitle() + ".tar"; tarFilePath = "/tmp/tarFileLocation/" + rootDu.getTitle() + "/" + tarFileName; long tarStartTime = System.nanoTime(); // tarDirectory(new File("/tmp/tarFileLocation/"+rootDu.getTitle()), "/tmp/tarFileLocation/"+rootDu.getTitle()+"/"+rootDu.getTitle()+".tar"); createTar(new File("/tmp/tarFileLocation/" + rootDu.getTitle()), "/tmp/tarFileLocation/" + rootDu.getTitle() + "/" + rootDu.getTitle() + ".tar"); // generateTar(new File("/tmp/tarFileLocation/"+rootDu.getTitle()), "/tmp/tarFileLocation/"+rootDu.getTitle()+"/"+rootDu.getTitle()+".tar"); long tarEndTime = System.nanoTime(); System.out.println("Time taken to tar file: " + (TimeUnit.SECONDS.convert((tarEndTime - tarStartTime), TimeUnit.NANOSECONDS)) + " seconds"); // SeadDataLocation dataLocation = new SeadDataLocation(); dataLocation.setName(ArchiveEnum.Archive.SDA.getArchive()); dataLocation.setType(ArchiveEnum.Archive.SDA.getType().getText()); dataLocation.setLocation(t_sipDirectory + "/" + tarFileName); dataLocation.setName(ArchiveEnum.Archive.SDA.getArchive()); } String oreFilePath = oreConversion(sipSource, collectionName); System.out.println("oreFilePath: " + oreFilePath); //Upload the tar file System.out.println( "Uploading the tar file: " + tarFilePath + " - " + t_sipDirectory + " - " + tarFileName); try { if (sftp != null) { long sftpStartTime = System.nanoTime(); sftp.uploadFile(tarFilePath, t_sipDirectory + "/" + tarFileName, useMount); long sftpEndTime = System.nanoTime(); System.out.println("Time taken to transfer file: " + (TimeUnit.SECONDS.convert((sftpEndTime - sftpStartTime), TimeUnit.NANOSECONDS)) + " seconds"); } } catch (NullPointerException npe) { System.err.println("SFTP Tar file upload failed!"); } System.out.println("End of tar file upload"); // //Upload the OAIORE file // System.out.println("Uploading the OAIORE file: "+oreFilePath+" - "+t_sipDirectory+" - "+collectionName+"_oaiore.xml"); // try { // if (sftp != null) { // sftp.uploadFile(oreFilePath, t_sipDirectory + "/" + collectionName + "_oaiore.xml", useMount); // } // }catch(NullPointerException npe){ // System.err.println("SFTP OAI ORE file upload failed!"); // } try { if (sftp != null) { sftp.uploadFile(sipSource, t_sipDirectory + "/" + UUID.randomUUID().toString() + "_sip.xml", useMount); } } catch (NullPointerException npe) { System.err.println("SFTP SIP file upload failed!"); } System.out.println("End of SIP file upload"); System.out.println("###############################################################"); } else { for (DcsDeliverableUnit rootDu : rootDUs) { if (((SeadDeliverableUnit) rootDu).getPrimaryLocation().getLocation() == null) { sipDirectory = rootDu.getTitle(); try { if (sftp != null) { sftp.createDirectory(rootDu.getTitle()); } } catch (NullPointerException npe) { System.err.println("SFTP Create Directory failed!"); } } else { sipDirectory = ((SeadDeliverableUnit) rootDu).getPrimaryLocation().getLocation(); } //archive metadata files for (DcsMetadataRef metadataRef : rootDu.getMetadataRef()) { for (DcsFile file : files) { if (file.getId().equalsIgnoreCase(metadataRef.getRef())) { String fileName = file.getName(); try { if (sftp != null) { sftp.uploadFile(file.getSource().replace("file://", ""), sipDirectory + "/" + fileName, useMount); } } catch (NullPointerException npe) { System.err.println("SFTP Metadata file upload failed!"); } SeadDataLocation dataLocation = new SeadDataLocation(); dataLocation.setType(ArchiveEnum.Archive.SDA.getType().getText()); dataLocation.setLocation(sipDirectory + "/" + fileName); dataLocation.setName(ArchiveEnum.Archive.SDA.getArchive()); ((SeadFile) file).setPrimaryLocation(dataLocation); } } } String id = rootDu.getId(); if (leftOverParents.contains(id)) leftOverParents.remove(id); for (DcsDeliverableUnit du : dus) { if (du.getId().equals(rootDu.getId())) { SeadDataLocation dataLocation = new SeadDataLocation(); dataLocation.setName(ArchiveEnum.Archive.SDA.getArchive()); dataLocation.setType(ArchiveEnum.Archive.SDA.getType().getText()); dataLocation.setLocation(rootDu.getTitle()); ((SeadDeliverableUnit) du).setPrimaryLocation(dataLocation); break; } } uploadToSDA(sftp, rootDu.getId(), rootDu.getTitle(), dus, pkg.getManifestations(), files); } //Get missing parents from Solr for (String otherParent : leftOverParents) { DcsEntity entity = null; try { entity = solrService.lookupEntity(otherParent); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (SolrServerException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } if (entity != null) { if (entity instanceof SeadDeliverableUnit) { if (((SeadDeliverableUnit) entity).getSecondaryDataLocations() != null && ((SeadDeliverableUnit) entity).getSecondaryDataLocations().size() > 0) { for (SeadDataLocation location : ((SeadDeliverableUnit) entity) .getSecondaryDataLocations()) { if (location.getName().equalsIgnoreCase(ArchiveEnum.Archive.SDA.getArchive()) && location.getType() .equalsIgnoreCase(ArchiveEnum.Archive.SDA.getType().getText())) { sipDirectory = location.getLocation().split("/")[0]; uploadToSDA(sftp, otherParent, location.getLocation(), dus, pkg.getManifestations(), files); break; } } } else { if (((SeadDeliverableUnit) entity).getPrimaryLocation() != null) { if (((SeadDeliverableUnit) entity).getPrimaryLocation().getName() .equalsIgnoreCase(ArchiveEnum.Archive.SDA.getArchive()) && ((SeadDeliverableUnit) entity).getPrimaryLocation().getType() .equalsIgnoreCase(ArchiveEnum.Archive.SDA.getType().getText())) { sipDirectory = ((SeadDeliverableUnit) entity).getPrimaryLocation().getLocation() .split("/")[0]; uploadToSDA(sftp, otherParent, ((SeadDeliverableUnit) entity).getPrimaryLocation().getLocation(), dus, pkg.getManifestations(), files); } } } } } } pkg.setDeliverableUnits(dus); pkg.setFiles(files); try { if (sftp != null) { sftp.uploadFile(sipSource, sipDirectory + "/" + UUID.randomUUID().toString() + "_sip.xml", useMount); } } catch (NullPointerException npe) { System.err.println("SFTP Upload failed!"); } } if (sftp != null) { sftp.disConnectSession(); } return pkg; }