@Override public void setComment(String comment) { s3 = null; super.setComment(comment); }
public void setVersionComment(String versionComment) { FileData fileData = getFileData(); if (fileData != null) { fileData.setComment(versionComment); } else { this.versionComment = versionComment; } }
@Override public void setComment(String comment) { verifyInitialized(); super.setComment(comment); }
private FileData createFileData(ResultSet rs) throws SQLException { FileData fileData = new FileData(); fileData.setName(rs.getString("file_name")); fileData.setSize(rs.getLong("file_size")); fileData.setAuthor(rs.getString("author")); fileData.setComment(rs.getString("file_comment")); fileData.setModifiedAt(rs.getTimestamp("modified_at")); fileData.setVersion(rs.getString("id")); fileData.setDeleted(rs.getBoolean("deleted")); return fileData; }
private FileData createFileData(ZipEntry entry) { FileData fileData = new FileData(); fileData.setName(zipPath + "/" + entry.getName()); fileData.setSize(entry.getSize()); fileData.setModifiedAt(new Date(entry.getTime())); fileData.setComment(entry.getComment()); return fileData; } }
private FileData createFileData(ResultSet rs) throws SQLException { FileData fileData = new FileData(); fileData.setName(rs.getString("file_name")); fileData.setSize(rs.getLong("file_size")); fileData.setAuthor(rs.getString("author")); fileData.setComment(rs.getString("file_comment")); fileData.setModifiedAt(rs.getTimestamp("modified_at")); fileData.setVersion(rs.getString("id")); fileData.setDeleted(rs.getBoolean("deleted")); return fileData; }
private void verifyLoaded() { AmazonS3 api = s3; if (api != null) { GetObjectMetadataRequest request = new GetObjectMetadataRequest(bucketName, getName(), getVersion()); ObjectMetadata metadata = api.getObjectMetadata(request); Map<String, String> userMetadata = metadata.getUserMetadata(); super.setAuthor(decode(userMetadata.get(METADATA_AUTHOR))); super.setComment(decode(userMetadata.get(METADATA_COMMENT))); s3 = null; } }
public void save() throws ProjectException { WorkspaceUser user = workspace.getUser(); // Override comment to avoid reusing of comment from previous version (we create a new project but it can contain // unerasable history for example in Git). project.getFileData().setComment(Comments.createProject(project.getName())); project.save(user); workspace.refresh(); }
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; } } }
@Override public FileData rename(String srcName, FileData destData) throws IOException { copy(srcName, destData); FileData srcData = new FileData(); srcData.setName(srcName); srcData.setVersion(null); srcData.setAuthor(destData.getAuthor()); srcData.setComment(destData.getComment()); deleteHistory(srcData); onModified(); return check(destData.getName()); }
private FileData createFileData(String name, ArtefactAPI project) throws PropertyException { FileData fileData = new FileData(); fileData.setName(name); // It's impossible to calculate zip size if project contains artefacts if (((FolderAPI) project).getArtefacts().size() == 0) { fileData.setSize(0); } fileData.setDeleted(project.hasProperty(ArtefactProperties.PROP_PRJ_MARKED_4_DELETION)); if (project.hasProperty(ArtefactProperties.VERSION_COMMENT)) { Property property = project.getProperty(ArtefactProperties.VERSION_COMMENT); fileData.setComment(property.getString()); } ProjectVersion version = project.getVersion(); fileData.setAuthor(version.getVersionInfo().getCreatedBy()); fileData.setModifiedAt(version.getVersionInfo().getCreatedAt()); fileData.setVersion(String.valueOf(version.getRevision())); return fileData; }
private FileData createFileData(String name, ArtefactAPI project) throws PropertyException { FileData fileData = new FileData(); fileData.setName(name); // It's impossible to calculate zip size if project contains artefacts if (((FolderAPI) project).getArtefacts().size() == 0) { fileData.setSize(0); } fileData.setDeleted(project.hasProperty(ArtefactProperties.PROP_PRJ_MARKED_4_DELETION)); if (project.hasProperty(ArtefactProperties.VERSION_COMMENT)) { Property property = project.getProperty(ArtefactProperties.VERSION_COMMENT); fileData.setComment(property.getString()); } ProjectVersion version = project.getVersion(); fileData.setAuthor(version.getVersionInfo().getCreatedBy()); fileData.setModifiedAt(version.getVersionInfo().getCreatedAt()); fileData.setVersion(String.valueOf(version.getRevision())); return fileData; }
public void erase(CommonUser user) throws ProjectException { FileData fileData = getFileData(); FileData data = new FileData(); data.setName(fileData.getName()); data.setVersion(null); data.setAuthor(user.getUserName()); data.setComment(Comments.eraseProject(getName())); if (!getRepository().deleteHistory(data)) { throw new ProjectException("Can't erase project because it is absent or can't be deleted"); } }
fileData.setComment(message);
@Override public void erase(CommonUser user) throws ProjectException { try { if (designFolderName != null) { FileData data = new FileData(); data.setName(designFolderName); data.setVersion(null); data.setAuthor(getUser().getUserName()); data.setComment(Comments.eraseProject(getName())); if (!designRepository.deleteHistory(data)) { throw new ProjectException("Can't erase project because it is absent or can't be deleted"); } } else { deleteFromLocalRepository(); } } finally { refresh(); } }
@Override public FileData copyHistory(String srcName, FileData destData, String version) throws IOException { FileItem fileItem = null; try { fileItem = readHistory(srcName, version); FileData copy = new FileData(); copy.setName(destData.getName()); copy.setComment(destData.getComment()); copy.setAuthor(destData.getAuthor()); copy.setSize(fileItem.getData().getSize()); return save(copy, fileItem.getStream()); } finally { if (fileItem != null) { IOUtils.closeQuietly(fileItem.getStream()); } } }
@Override public FileData copyHistory(String srcName, FileData destData, String version) throws IOException { FileItem fileItem = null; try { fileItem = readHistory(srcName, version); FileData copy = new FileData(); copy.setName(destData.getName()); copy.setComment(destData.getComment()); copy.setAuthor(destData.getAuthor()); copy.setSize(fileItem.getData().getSize()); return save(copy, fileItem.getStream()); } finally { if (fileItem != null) { IOUtils.closeQuietly(fileItem.getStream()); } } }
@Override public void save(CommonUser user) throws ProjectException { AProject designProject = new AProject(designRepository, designFolderName); AProject localProject = new AProject(localRepository, localFolderName); designProject.getFileData().setComment(getFileData().getComment()); designProject.update(localProject, user); String version = designProject.getFileData().getVersion(); setLastHistoryVersion(version); setHistoryVersion(version); if (!isRepositoryOnly()) { localRepository.getProjectState(localFolderName).setProjectVersion(null); } clearModifyStatus(); unlock(); refresh(); }
public void delete(CommonUser user) throws ProjectException { if (isDeleted()) { throw new ProjectException("Project ''{0}'' is already marked for deletion!", null, getName()); } unlock(); close(user); FileData fileData = getFileData(); FileData data = new FileData(); data.setName(fileData.getName()); data.setVersion(fileData.getVersion()); data.setAuthor(user.getUserName()); data.setComment(Comments.archiveProject(getName())); if (!getRepository().delete(data)) { throw new ProjectException("Resource is absent or can't be deleted"); } setFileData(null); }
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); } }