private void processTransferredResource(IndexService index, ModelService model, StorageService storage, Report report, Job job, TransferredResource transferredResource) { Report reportItem = PluginHelper.initPluginReportItem(this, transferredResource); Path earkSIPPath = Paths.get(transferredResource.getFullPath()); LOGGER.debug("Converting {} to AIP", earkSIPPath); transformTransferredResourceIntoAnAIP(index, model, storage, transferredResource, earkSIPPath, createSubmission, reportItem, job.getId(), computedSearchScope, forceSearchScope, jobWorkingDirectory); report.addReport(reportItem); PluginHelper.createJobReport(this, model, reportItem); }
RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); if (FSUtils.exists(Paths.get(resource.getFullPath()))) { Path resourcePath = Paths.get(resource.getFullPath()); Path newPath = resourcePath.getParent().resolve(newName); FSUtils.move(resourcePath, newPath, replaceExisting);
public void deleteTransferredResource(TransferredResource transferredResource) throws GenericException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); FSUtils.deletePathQuietly(Paths.get(transferredResource.getFullPath())); notifyTransferredResourceDeleted(transferredResource.getUUID()).failOnError(); }
private void processTransferredResource(ModelService model, Report report, JobPluginInfo pluginInfo, Job job, TransferredResource transferredResource) { Report reportItem = PluginHelper.initPluginReportItem(this, transferredResource); PluginHelper.updatePartialJobReport(this, model, reportItem, false, job); try { LOGGER.debug("Removing SIP {}", transferredResource.getFullPath()); model.deleteTransferredResource(transferredResource); LOGGER.debug("Done with removing SIP {}", transferredResource.getFullPath()); if (createEvent) { model.createRepositoryEvent(PreservationEventType.DELETION, "The process of deleting an object of the repository", PluginState.SUCCESS, "The transferred resource " + transferredResource.getId() + " has been deleted.", "", job.getUsername(), true); } pluginInfo.incrementObjectsProcessedWithSuccess(); } catch (RuntimeException | GenericException | AuthorizationDeniedException e) { if (createEvent) { model.createRepositoryEvent(PreservationEventType.DELETION, "The process of deleting an object of the repository", PluginState.SUCCESS, "The transferred resource " + transferredResource.getId() + " has not been deleted.", "", job.getUsername(), true); } pluginInfo.incrementObjectsProcessedWithFailure(); reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(e.getMessage()); LOGGER.error("Error removing transferred resource " + transferredResource.getFullPath(), e); } report.addReport(reportItem); PluginHelper.updatePartialJobReport(this, model, reportItem, true, job); }
if (FSUtils.exists(Paths.get(resource.getFullPath()))) { Path newResourcePath = basePath.resolve(newRelativePath); if (addOldRelativePathToNewRelativePath) { FSUtils.move(Paths.get(resource.getFullPath()), newResourcePath, replaceExisting);
} else if (object instanceof TransferredResource) { TransferredResource o = (TransferredResource) object; ret = get(TransferredResource.class, Arrays.asList(o.getFullPath()), false); } else if (object instanceof Report) { Report o = (Report) object;
private void processTransferredResource(IndexService index, ModelService model, Report report, Job job, TransferredResource transferredResource) { Report reportItem = PluginHelper.initPluginReportItem(this, transferredResource); Path bagitPath = Paths.get(transferredResource.getFullPath()); try { LOGGER.debug("Converting {} to AIP", bagitPath); SIP bagit = BagitSIP.parse(bagitPath); Optional<String> computedParentId = PluginHelper.getComputedParent(model, index, bagit.getAncestors(), computedSearchScope, forceSearchScope, job.getId()); AIP aipCreated = BagitToAIPPluginUtils.bagitToAip(bagit, model, METADATA_FILE, Arrays.asList(transferredResource.getName()), reportItem.getJobId(), computedParentId, job.getUsername(), PermissionUtils.getIngestPermissions(job.getUsername()), transferredResource.getUUID()); PluginHelper.createSubmission(model, createSubmission, bagitPath, aipCreated.getId()); createUnpackingEventSuccess(model, index, transferredResource, aipCreated, UNPACK_DESCRIPTION); reportItem.setSourceAndOutcomeObjectId(reportItem.getSourceObjectId(), aipCreated.getId()) .setPluginState(PluginState.SUCCESS); if (aipCreated.getParentId() == null && computedParentId.isPresent()) { reportItem.setPluginDetails(String.format("Parent with id '%s' not found", computedParentId.get())); } createWellformedEventSuccess(model, index, transferredResource, aipCreated); LOGGER.debug("Done with converting {} to AIP {}", bagitPath, aipCreated.getId()); } catch (RODAException | RuntimeException | ParseException e) { reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(e.getMessage()); LOGGER.error("Error converting " + bagitPath + " to AIP", e); } report.addReport(reportItem); PluginHelper.createJobReport(this, model, reportItem); }
Path transferredResourcePath = Paths.get(transferredResource.getFullPath()); LOGGER.debug("Converting {} to AIP", transferredResourcePath); AIPState state = AIPState.INGEST_PROCESSING;
@Override public SolrInputDocument toSolrDocument(TransferredResource tr, IndexingAdditionalInfo info) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException { SolrInputDocument doc = super.toSolrDocument(tr, info); doc.addField(RodaConstants.TRANSFERRED_RESOURCE_FULLPATH, tr.getFullPath()); if (tr.getParentId() != null) { doc.addField(RodaConstants.TRANSFERRED_RESOURCE_PARENT_ID, tr.getParentId()); doc.addField(RodaConstants.TRANSFERRED_RESOURCE_PARENT_UUID, IdUtils.createUUID(tr.getParentId())); } if (tr.getRelativePath() != null) { doc.addField(RodaConstants.TRANSFERRED_RESOURCE_RELATIVEPATH, tr.getRelativePath()); } doc.addField(RodaConstants.TRANSFERRED_RESOURCE_DATE, SolrUtils.formatDate(tr.getCreationDate())); doc.addField(RodaConstants.TRANSFERRED_RESOURCE_ISFILE, tr.isFile()); doc.addField(RodaConstants.TRANSFERRED_RESOURCE_SIZE, tr.getSize()); doc.addField(RodaConstants.TRANSFERRED_RESOURCE_NAME, tr.getName()); if (tr.getAncestorsPaths() != null && !tr.getAncestorsPaths().isEmpty()) { doc.addField(RodaConstants.TRANSFERRED_RESOURCE_ANCESTORS, tr.getAncestorsPaths()); } doc.addField(RodaConstants.TRANSFERRED_RESOURCE_LAST_SCAN_DATE, SolrUtils.formatDateWithMillis(tr.getLastScanDate())); return doc; }