@Override public boolean isDeleted() { verifyInitialized(); return super.isDeleted(); }
public boolean isDeleted() { return getFileData().isDeleted(); }
@Override public FileItem read(String name) throws IOException { try { FileData fileData = check(name); if (fileData == null) { return null; } InputStream objectContent = null; if (!fileData.isDeleted()) { S3Object object = s3.getObject(bucketName, name); objectContent = object.getObjectContent(); } return objectContent == null ? null : new FileItem(fileData, objectContent); } catch (SdkClientException e) { throw new IOException(e); } }
protected Map<String, AProjectArtefact> createInternalArtefacts() { HashMap<String, AProjectArtefact> internalArtefacts = new HashMap<>(); Collection<FileData> fileDatas; try { String folderPath = getFolderPath(); if (!folderPath.isEmpty() && !folderPath.endsWith("/")) { folderPath += "/"; } if (isHistoric()) { if (getRepository() instanceof FolderRepository) { fileDatas = ((FolderRepository) getRepository()).listFiles(folderPath, getFileData().getVersion()); } else { throw new UnsupportedOperationException("Can't get internal artifacts for historic project version"); } } else { fileDatas = getRepository().list(folderPath); } } catch (IOException ex) { throw RuntimeExceptionWrapper.wrap(ex); } for (FileData fileData : fileDatas) { if (!fileData.getName().equals(folderPath) && !fileData.isDeleted()) { String artefactName = fileData.getName().substring(folderPath.length() + 1); internalArtefacts.put(artefactName, new AProjectResource(getProject(), getRepository(), fileData)); } } return internalArtefacts; }
if (existing != null && existing.isDeleted()) {
private void verifyInitialized() { if (project != null) { List<FileData> fileDatas = project.getHistoryFileDatas(); if (!fileDatas.isEmpty()) { FileData repoData = null; String version = getVersion(); if (version == null) { repoData = fileDatas.get(fileDatas.size() - 1); } else { for (FileData data : fileDatas) { if (data.getVersion().equals(version)) { repoData = data; break; } } } if (repoData != null) { super.setAuthor(repoData.getAuthor()); super.setModifiedAt(repoData.getModifiedAt()); super.setComment(repoData.getComment()); super.setSize(repoData.getSize()); super.setDeleted(repoData.isDeleted()); } } project = null; } } }
if (existing != null && existing.isDeleted()) {
if (!fileData.isDeleted()) {
fullLocalFileData.setModifiedAt(designFileData.getModifiedAt()); fullLocalFileData.setComment(designFileData.getComment()); fullLocalFileData.setDeleted(designFileData.isDeleted()); setFileData(fullLocalFileData); } else {
public void undelete(CommonUser user) throws ProjectException { try { if (!isDeleted()) { throw new ProjectException("Cannot undelete non-marked project ''{0}''!", null, getName()); } Repository repository = getRepository(); FileData fileData = repository.check(getFileData().getName()); if (fileData != null && fileData.isDeleted()) { FileData data = new FileData(); data.setName(fileData.getName()); data.setVersion(fileData.getVersion()); data.setAuthor(user.getUserName()); data.setComment(Comments.restoreProject(getName())); repository.deleteHistory(data); FileData actual = repository.check(fileData.getName()); setFileData(actual); String version = actual.getVersion(); setLastHistoryVersion(version); setHistoryVersion(version); } } catch (IOException ex) { throw new ProjectException("Cannot undelete a project", ex); } }