public boolean hasDDProject(String name) { try { return getRepository().check(deploymentConfigurationLocation + name) != null; } catch (IOException ex) { return false; } }
@Override public FileData getFileData() { FileData fileData = super.getFileData(); if (fileData == null) { Repository repository = getRepository(); if (isRepositoryVersionable()) { // In the case of FolderRepository we can retrieve FileData using check()/checkHistory() for a folder. try { if (!isHistoric() || isLastVersion()) { fileData = repository.check(getFolderPath()); if (fileData == null) { fileData = new LazyFileData(getFolderPath(), getHistoryVersion(), this); } } else { fileData = repository.checkHistory(getFolderPath(), getHistoryVersion()); } } catch (IOException ex) { throw new IllegalStateException(ex); } } else { fileData = new LazyFileData(getFolderPath(), getHistoryVersion(), this); } setFileData(fileData); } return fileData; }
public AProjectResource addResource(String name, InputStream content) throws ProjectException { try { getProject().lock(); FileData fileData = new FileData(); String fullName = folderPath + "/" + name; fileData.setName(fullName); Repository repository = getRepository(); if (repository.check(fullName) != null) { throw new ProjectException(String.format("The file '%s' exists in the folder.", name), new IOException()); } fileData = repository.save(fileData, content); AProjectResource createdResource = new AProjectResource(getProject(), repository, fileData); getArtefactsInternal().put(name, createdResource); return createdResource; } catch (IOException ex) { throw new ProjectException("Cannot add a resource", ex); } finally { IOUtils.closeQuietly(content); } }
FileData existing = getRepository().check(fileName); if (existing != null && existing.isDeleted()) {
FileData existing = repository.check(fileName); if (existing != null && existing.isDeleted()) {
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); } }