diff --git a/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/AttachmentDatabaseHandler.java b/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/AttachmentDatabaseHandler.java index 4bea5d6a04..77224ab450 100644 --- a/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/AttachmentDatabaseHandler.java +++ b/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/AttachmentDatabaseHandler.java @@ -271,4 +271,7 @@ public List getAttachmentOwnersByIds(Set ids) { public List getAttachmentUsagesByReleaseId(String releaseId) { return attachmentUsageRepository.getUsagesByReleaseId(releaseId); } + public RequestStatus deleteOldAttachmentFromFileSystem() throws TException { + return DatabaseHandlerUtil.deleteOldAttachmentFromFileSystem(); + } } diff --git a/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/DatabaseHandlerUtil.java b/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/DatabaseHandlerUtil.java index 860514c451..e4c0034d8a 100644 --- a/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/DatabaseHandlerUtil.java +++ b/backend/src-common/src/main/java/org/eclipse/sw360/datahandler/db/DatabaseHandlerUtil.java @@ -9,16 +9,24 @@ */ package org.eclipse.sw360.datahandler.db; +import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.DirectoryStream; +import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardOpenOption; +import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.Arrays; import java.util.Collection; import java.util.Date; @@ -57,6 +65,7 @@ import org.eclipse.sw360.datahandler.couchdb.DatabaseMixInForChangeLog.RepositoryMixin; import org.eclipse.sw360.datahandler.couchdb.DatabaseMixInForChangeLog.VendorMixin; import org.eclipse.sw360.datahandler.thrift.ProjectReleaseRelationship; +import org.eclipse.sw360.datahandler.thrift.RequestStatus; import org.eclipse.sw360.datahandler.thrift.SW360Exception; import org.eclipse.sw360.datahandler.thrift.attachments.Attachment; import org.eclipse.sw360.datahandler.thrift.attachments.AttachmentContent; @@ -101,6 +110,7 @@ public class DatabaseHandlerUtil { private static final String ATTACHMENT_STORE_FILE_SYSTEM_LOCATION; private static final String ATTACHMENT_STORE_FILE_SYSTEM_PERMISSION; private static ExecutorService ATTACHMENT_FILE_SYSTEM_STORE_THREAD_POOL = Executors.newFixedThreadPool(5); + private static final String ATTACHMENT_DELETE_NO_OF_DAYS; static { Properties props = CommonUtils.loadProperties(DatabaseSettings.class, PROPERTIES_FILE_PATH); ATTACHMENT_STORE_FILE_SYSTEM_LOCATION = props.getProperty("attachment.store.file.system.location", @@ -108,6 +118,8 @@ public class DatabaseHandlerUtil { ATTACHMENT_STORE_FILE_SYSTEM_PERMISSION = props.getProperty("attachment.store.file.system.permission", "rwx------"); IS_STORE_ATTACHMENT_TO_FILE_SYSTEM_ENABLED = Boolean.parseBoolean(props.getProperty("enable.attachment.store.to.file.system", "false")); + ATTACHMENT_DELETE_NO_OF_DAYS = props.getProperty("attachemnt.delete.no.of.days", + "30"); } public DatabaseHandlerUtil(DatabaseConnectorCloudant db) { @@ -795,4 +807,47 @@ public static void saveAttachmentInFileSystem(AttachmentConnector attachmentConn attachmentContentId, att.getFilename()); }); } -} \ No newline at end of file + + public static RequestStatus deleteOldAttachmentFromFileSystem() { + int noOfDays = Integer.parseInt(ATTACHMENT_DELETE_NO_OF_DAYS); + RequestStatus status = null; + LocalDate todayDate = LocalDate.now(); + LocalDate thresholdDateForAttachmentDelete = todayDate.minusDays(noOfDays); + Date thresholdDate = Date.from(thresholdDateForAttachmentDelete.atStartOfDay(ZoneId.systemDefault()).toInstant()); + try { + deleteAttachmentAndDirectory(ATTACHMENT_STORE_FILE_SYSTEM_LOCATION, thresholdDate); + status = RequestStatus.SUCCESS; + } catch (IOException e) { + log.error("Unable to delete attachment. ", e); + status = RequestStatus.FAILURE; + } + return status; + } + + public static void deleteAttachmentAndDirectory(String directoryFilePath, Date thresholdDate) throws IOException { + Path directory = Paths.get(directoryFilePath); + if (Files.exists(directory)) { + Files.walkFileTree(directory, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) throws IOException { + File file = path.toFile(); + long fileLastModifiedDate = file.lastModified(); + Date modifieddate = new Date(fileLastModifiedDate); + if (thresholdDate.after(modifieddate)) { + Files.delete(path); + } + return FileVisitResult.CONTINUE; + } + @Override + public FileVisitResult postVisitDirectory(Path directory, IOException ioException) throws IOException { + DirectoryStream stream = Files.newDirectoryStream(directory); + boolean isFolderEmpty = !stream.iterator().hasNext(); + if (isFolderEmpty) { + Files.delete(directory); + } + return FileVisitResult.CONTINUE; + } + }); + } + } +} diff --git a/backend/src-common/src/main/resources/sw360.properties b/backend/src-common/src/main/resources/sw360.properties index 6cdb7eaa63..09da35a1c6 100644 --- a/backend/src-common/src/main/resources/sw360.properties +++ b/backend/src-common/src/main/resources/sw360.properties @@ -72,3 +72,4 @@ textForRejectedClearingRequest= your clearing request with id: %s for the projec #attachment.store.file.system.location=/opt/sw360tempattachments #enable.attachment.store.to.file.system=false #attachment.store.file.system.permission=rwx------ +#attachemnt.delete.no.of.days=30 diff --git a/backend/src/src-attachments/src/main/java/org/eclipse/sw360/attachments/AttachmentHandler.java b/backend/src/src-attachments/src/main/java/org/eclipse/sw360/attachments/AttachmentHandler.java index b542fc8b58..793e4b820f 100644 --- a/backend/src/src-attachments/src/main/java/org/eclipse/sw360/attachments/AttachmentHandler.java +++ b/backend/src/src-attachments/src/main/java/org/eclipse/sw360/attachments/AttachmentHandler.java @@ -243,4 +243,8 @@ public List getAttachmentUsagesByReleaseId(String releaseId) th return handler.getAttachmentUsagesByReleaseId(releaseId); } + @Override + public RequestStatus deleteOldAttachmentFromFileSystem() throws TException { + return handler.deleteOldAttachmentFromFileSystem(); + } } diff --git a/backend/src/src-projects/src/main/java/org/eclipse/sw360/projects/ProjectHandler.java b/backend/src/src-projects/src/main/java/org/eclipse/sw360/projects/ProjectHandler.java index 5a0b1b4ac2..5761565638 100644 --- a/backend/src/src-projects/src/main/java/org/eclipse/sw360/projects/ProjectHandler.java +++ b/backend/src/src-projects/src/main/java/org/eclipse/sw360/projects/ProjectHandler.java @@ -374,4 +374,4 @@ public List> getClearingStateInformationForListView(String p assertNotNull(projectId); return handler.getClearingStateInformationForListView(projectId,user); } -} \ No newline at end of file +} diff --git a/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/service/ScheduleHandler.java b/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/service/ScheduleHandler.java index b841d49d0c..37e771a1a2 100644 --- a/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/service/ScheduleHandler.java +++ b/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/service/ScheduleHandler.java @@ -69,6 +69,9 @@ public RequestSummary scheduleService(String serviceName) throws TException { case ThriftClients.CVESEARCH_SERVICE: successSync = wrapSupplierException(() -> thriftClients.makeCvesearchClient().update(), serviceName); break; + case ThriftClients.DELETE_ATTACHMENT_SERVICE: + successSync = wrapSupplierException(() -> thriftClients.makeAttachmentClient().deleteOldAttachmentFromFileSystem(), serviceName); + break; default: log.error("Could not schedule service: " + serviceName + ". Reason: service is not registered in ThriftClients."); } diff --git a/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/timer/ScheduleConstants.java b/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/timer/ScheduleConstants.java index 00c7a49a18..9fc8dc9151 100644 --- a/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/timer/ScheduleConstants.java +++ b/backend/src/src-schedule/src/main/java/org/eclipse/sw360/schedule/timer/ScheduleConstants.java @@ -36,7 +36,10 @@ private ScheduleConstants(){} public static final String AUTOSTART_PROPERTY_NAME = "autostart"; public static final String CVESEARCH_OFFSET_DEFAULT = 0 + "" ; // default 00:00 am, in seconds public static final String CVESEARCH_INTERVAL_DEFAULT = (24*60*60)+"" ; // default 24h, in seconds - + public static final String DELETE_ATTACHMENT_OFFSET_DEFAULT = "0"; // default 00:00 am, in seconds + public static final String DELETE_ATTACHMENT_INTERVAL_DEFAULT = (24*60*60) + "" ; // default 24h, in seconds + public static final String DELETE_ATTACHMENT_OFFSET_PROPERTY_NAME = "schedule.delete.attachment.firstOffset.seconds"; + public static final String DELETE_ATTACHMENT_INTERVAL_PROPERTY_NAME = "schedule.delete.attachment.interval.seconds"; // scheduler properties public static final ConcurrentHashMap SYNC_FIRST_RUN_OFFSET_SEC = new ConcurrentHashMap<>(); @@ -69,8 +72,29 @@ private ScheduleConstants(){} invalidConfiguredServices.add(ThriftClients.CVESEARCH_SERVICE); } + if(! props.containsKey(DELETE_ATTACHMENT_OFFSET_PROPERTY_NAME)){ + log.debug("Property " + DELETE_ATTACHMENT_OFFSET_PROPERTY_NAME + " not set. Using default value."); + } + String deleteAttachmentOffset = props.getProperty(DELETE_ATTACHMENT_OFFSET_PROPERTY_NAME, DELETE_ATTACHMENT_OFFSET_DEFAULT); + try { + SYNC_FIRST_RUN_OFFSET_SEC.put(ThriftClients.DELETE_ATTACHMENT_SERVICE, Integer.parseInt(deleteAttachmentOffset)); + } catch (NumberFormatException nfe){ + log.error("Property " + DELETE_ATTACHMENT_OFFSET_PROPERTY_NAME + " is not an integer."); + invalidConfiguredServices.add(ThriftClients.DELETE_ATTACHMENT_SERVICE); + } + + if(! props.containsKey(DELETE_ATTACHMENT_INTERVAL_PROPERTY_NAME)){ + log.debug("Property "+ DELETE_ATTACHMENT_INTERVAL_PROPERTY_NAME + " not set. Using default value."); + } + String deleteAttachmentInterval = props.getProperty(DELETE_ATTACHMENT_INTERVAL_PROPERTY_NAME, DELETE_ATTACHMENT_INTERVAL_DEFAULT); + try { + SYNC_INTERVAL_SEC.put(ThriftClients.DELETE_ATTACHMENT_SERVICE, Integer.parseInt(deleteAttachmentInterval)); + } catch (NumberFormatException nfe){ + log.error("Property " + DELETE_ATTACHMENT_INTERVAL_PROPERTY_NAME + " is not an integer."); + invalidConfiguredServices.add(ThriftClients.DELETE_ATTACHMENT_SERVICE); + } + String autostartServicesString = props.getProperty(AUTOSTART_PROPERTY_NAME, ""); autostartServices = autostartServicesString.split(","); } - } diff --git a/backend/src/src-schedule/src/main/resources/sw360.properties b/backend/src/src-schedule/src/main/resources/sw360.properties index f64ca9da61..eaeb3d95d9 100644 --- a/backend/src/src-schedule/src/main/resources/sw360.properties +++ b/backend/src/src-schedule/src/main/resources/sw360.properties @@ -16,3 +16,7 @@ schedule.cvesearch.interval.seconds = 86400 #general pattern for scheduling multiple services: autostart = service1,service2,service3,... #for scheduling the cvesearchService, uncomment the following line: #autostart = cvesearchService + +schedule.delete.attachment.firstOffset.seconds = 0 + +schedule.delete.attachment.interval.seconds = 86400 diff --git a/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/common/PortalConstants.java b/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/common/PortalConstants.java index 151b4041ce..86e8eaaa32 100644 --- a/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/common/PortalConstants.java +++ b/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/common/PortalConstants.java @@ -355,6 +355,11 @@ public class PortalConstants { public static final String CVESEARCH_INTERVAL = "cvesearchInterval"; public static final String CVESEARCH_NEXT_SYNC = "cvesearchNextSync"; + public static final String DELETE_ATTACHMENT_IS_SCHEDULED = "deleteAttachmentIsScheduled"; + public static final String DELETE_ATTACHMENT_OFFSET = "deleteAttachmentOffset"; + public static final String DELETE_ATTACHMENT_INTERVAL = "deleteAttachmentInterval"; + public static final String DELETE_ATTACHMENT_NEXT_SYNC = "deleteAttachmentNextSync"; + //! Specialized keys for licenseInfo public static final String LICENSE_INFO_OUTPUT_FORMATS = "licenseInfoOutputFormats"; public static final String LICENSE_INFO_SELECTED_OUTPUT_FORMAT = "licenseInfoSelectedOutputFormat"; diff --git a/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/portlets/admin/ScheduleAdminPortlet.java b/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/portlets/admin/ScheduleAdminPortlet.java index 8f25d5aea0..d603ee5d13 100644 --- a/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/portlets/admin/ScheduleAdminPortlet.java +++ b/frontend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/portlets/admin/ScheduleAdminPortlet.java @@ -74,6 +74,15 @@ private void prepareStandardView(RenderRequest request, RenderResponse response) request.setAttribute(PortalConstants.CVESEARCH_INTERVAL, CommonUtils.formatTime(intervalInSeconds)); String nextSync = scheduleClient.getNextSync(ThriftClients.CVESEARCH_SERVICE); request.setAttribute(PortalConstants.CVESEARCH_NEXT_SYNC, nextSync); + + boolean isDeleteAttachmentScheduled = isDeleteAttachmentScheduled(scheduleClient, user); + request.setAttribute(PortalConstants.DELETE_ATTACHMENT_IS_SCHEDULED, isDeleteAttachmentScheduled); + int offsetInSecondsForDeleteAttachment = scheduleClient.getFirstRunOffset(ThriftClients.DELETE_ATTACHMENT_SERVICE); + request.setAttribute(PortalConstants.DELETE_ATTACHMENT_OFFSET, CommonUtils.formatTime(offsetInSecondsForDeleteAttachment)); + int intervalInSecondsForDeleteAttachment = scheduleClient.getInterval(ThriftClients.DELETE_ATTACHMENT_SERVICE); + request.setAttribute(PortalConstants.DELETE_ATTACHMENT_INTERVAL, CommonUtils.formatTime(intervalInSecondsForDeleteAttachment)); + String nextSyncForDeleteAttachment = scheduleClient.getNextSync(ThriftClients.DELETE_ATTACHMENT_SERVICE); + request.setAttribute(PortalConstants.DELETE_ATTACHMENT_NEXT_SYNC, nextSyncForDeleteAttachment); } catch (TException te) { log.error(te.getMessage()); } @@ -133,4 +142,60 @@ public void unscheduleAllServices(ActionRequest request, ActionResponse response log.error(e); } } + + private boolean isDeleteAttachmentScheduled(ScheduleService.Iface scheduleClient, User user) throws TException { + RequestStatusWithBoolean requestStatus = scheduleClient.isServiceScheduled(ThriftClients.DELETE_ATTACHMENT_SERVICE, user); + if(RequestStatus.SUCCESS.equals(requestStatus.getRequestStatus())){ + return requestStatus.isAnswerPositive(); + } else { + throw new SW360Exception("Backend query for schedule status of deleteAttachment failed."); + } + } + + @UsedAsLiferayAction + public void scheduleDeleteAttachment(ActionRequest request, ActionResponse response) throws PortletException, IOException { + try { + RequestSummary requestSummary = + new ThriftClients().makeScheduleClient().scheduleService(ThriftClients.DELETE_ATTACHMENT_SERVICE); + setSessionMessage(request, requestSummary.getRequestStatus(), "Task", "schedule"); + } catch (TException e) { + log.error("Unable to Schedule the delete attachment service. ", e); + e.printStackTrace(); + } + } + + @UsedAsLiferayAction + public void unscheduleDeleteAttachment(ActionRequest request, ActionResponse response) throws PortletException, IOException { + try { + User user = UserCacheHolder.getUserFromRequest(request); + RequestStatus requestStatus = + new ThriftClients().makeScheduleClient().unscheduleService(ThriftClients.DELETE_ATTACHMENT_SERVICE, user); + setSessionMessage(request, requestStatus, "Task", "unschedule"); + } catch (TException e) { + log.error("Unable to Unschedule the delete attachment service. ", e); + e.printStackTrace(); + } + } + + @UsedAsLiferayAction + public void triggerDeleteAttachment(ActionRequest request, ActionResponse response) throws PortletException, IOException { + try { + RequestStatus requestStatus = new ThriftClients().makeAttachmentClient().deleteOldAttachmentFromFileSystem(); + setSessionMessage(request, requestStatus, "Task", "perform"); + } catch (TException e) { + log.error("Unable to Manually trigger the delete attachment service. ", e); + e.printStackTrace(); + } + } + + @UsedAsLiferayAction + public void triggerCveSearch(ActionRequest request, ActionResponse response) throws PortletException, IOException { + try { + RequestStatus requestStatus = new ThriftClients().makeCvesearchClient().update(); + setSessionMessage(request, requestStatus, "Task", "perform"); + } catch (TException e) { + log.error("Unable to Manually trigger the CVE search service. ", e); + e.printStackTrace(); + } + } } diff --git a/frontend/sw360-portlet/src/main/resources/META-INF/resources/html/admin/scheduleAdmin/view.jsp b/frontend/sw360-portlet/src/main/resources/META-INF/resources/html/admin/scheduleAdmin/view.jsp index c5998fbefa..b97ae345ff 100644 --- a/frontend/sw360-portlet/src/main/resources/META-INF/resources/html/admin/scheduleAdmin/view.jsp +++ b/frontend/sw360-portlet/src/main/resources/META-INF/resources/html/admin/scheduleAdmin/view.jsp @@ -31,6 +31,18 @@ + + + + + + + + + + + +
@@ -70,4 +82,40 @@
+
+
+

+ + + + + + + + + + + + + +
+
+
+ + +
+
+
+
+
+
+

+
+
+ + +
+
+
+
diff --git a/frontend/sw360-portlet/src/main/resources/content/Language.properties b/frontend/sw360-portlet/src/main/resources/content/Language.properties index 3381086d9b..54b783c6f7 100644 --- a/frontend/sw360-portlet/src/main/resources/content/Language.properties +++ b/frontend/sw360-portlet/src/main/resources/content/Language.properties @@ -91,6 +91,7 @@ AttachmentType-SOURCE=original course code AttachmentType-SOURCE_SELF=Self assembled source code distribution attachment.usages=Attachment Usages attachment.usages2=attachment usage(s) +attachment.deletion.from.local.fs=Attachment Deletion From Local FS attribute.changes=Attribute Changes ausfuhrliste=Ausfuhrliste authorities=Authorities @@ -116,6 +117,7 @@ by.clicking.on.the.checkbox.in.the.header.row=by clicking on the checkbox in the cancel=Cancel cancel.all.scheduled.tasks=Cancel all Scheduled Tasks cancel.cve.service=Cancel CVE service +cancel.scheduled.attachment.deletion.from.local.fs=Cancel Scheduled Attachment Deletion From Local FS cannot.add.attachments.before.saving.the.document=Cannot add attachments before saving the document cannot.continue.to.merge.of.releases=Cannot continue to merge of releases: can.not.get.products=Can not get products! @@ -699,6 +701,7 @@ MainlineState-MAINLINE=Organisation or person thinks that use of this software i MainlineState-OPEN=Not decided so far MainlineState-PHASEOUT=The software has issues, please consider removing it soon, if in use. MainlineState-SPECIFIC=The software is not recommended in general, but for special use case or for this particular version it is acceptable. +manual.triggering.of.scheduled.services=Manual triggering of scheduled services matched.by=Matched by matching.source.attachments=Matching Source Attachments material.index.number=Material Index Number @@ -1053,6 +1056,7 @@ scanned=Scanned scan.the.sources=Scan the sources schedule=Schedule schedule.cve.service=Schedule CVE service +schedule.attachment.deletion.from.local.fs=Schedule Attachment Deletion From Local FS schedule.offset=Schedule Offset schedule.task.administration=Schedule Task Administration scope=Scope diff --git a/frontend/sw360-portlet/src/main/resources/content/Language_ja.properties b/frontend/sw360-portlet/src/main/resources/content/Language_ja.properties index 97bbbc6897..6a8975ea14 100644 --- a/frontend/sw360-portlet/src/main/resources/content/Language_ja.properties +++ b/frontend/sw360-portlet/src/main/resources/content/Language_ja.properties @@ -92,6 +92,7 @@ AttachmentType-SOURCE=オリジナルコースコード AttachmentType-SOURCE_SELF=自作のソースコード配布 attachment.usages=添付ファイルの用途 attachment.usages2=添付ファイルの用途 +attachment.deletion.from.local.fs=Attachment Deletion From Local FS attribute.changes=属性変更 ausfuhrliste=箇条書き authorities=権利者 @@ -117,6 +118,7 @@ by.clicking.on.the.checkbox.in.the.header.row=ヘッダーのチェックボッ cancel=キャンセル cancel.all.scheduled.tasks=予定されたタスクをすべてキャンセルする cancel.cve.service=CVEサービスのキャンセル +cancel.scheduled.attachment.deletion.from.local.fs=Cancel Scheduled Attachment Deletion From Local FS cannot.add.attachments.before.saving.the.document=ドキュメントを保存する前に添付ファイルを追加することはできません cannot.continue.to.merge.of.releases=リリースのマージを続けることができません。 can.not.get.products=製品を取得できません! @@ -700,6 +702,7 @@ MainlineState-MAINLINE=組織や人は、複数のバージョンが含まれて MainlineState-OPEN=今のところ決定していない MainlineState-PHASEOUT=このソフトウェアには問題がありますので、使用中の場合はすぐに削除を検討してください。 MainlineState-SPECIFIC=一般的にはお勧めできませんが、特殊な使用例やこの特定のバージョンでは許容範囲内です。 +manual.triggering.of.scheduled.services=Manual triggering of scheduled services matched.by=適合 matching.source.attachments=適合添付ソースファイル material.index.number=部品識別番号 @@ -1053,6 +1056,7 @@ scanned=スキャンされた scan.the.sources=ソースをスキャン schedule=スケジュール schedule.cve.service=CVEサービスのスケジュール +schedule.attachment.deletion.from.local.fs=Schedule Attachment Deletion From Local FS schedule.offset=スケジュールオフセット schedule.task.administration=スケジュールタスク管理 scope=Scope diff --git a/frontend/sw360-portlet/src/main/resources/content/Language_vi.properties b/frontend/sw360-portlet/src/main/resources/content/Language_vi.properties index 8afc4dc07d..8f8ef145f9 100644 --- a/frontend/sw360-portlet/src/main/resources/content/Language_vi.properties +++ b/frontend/sw360-portlet/src/main/resources/content/Language_vi.properties @@ -93,6 +93,7 @@ AttachmentType-SOURCE_SELF=Bản phân phối của mã nguồn tự kết hợp attribute.changes=Attribute Changes attachment.usages=Sử dụng Tệp đính kèm attachment.usages2=sử dụng tệp đính kèm +attachment.deletion.from.local.fs=Attachment Deletion From Local FS ausfuhrliste=Ausfuhrliste authorities=Quyền authorization.header.authorization.token.api.token=Phần đầu mã truy cập. (Authorization: Mã truy cập ) @@ -117,6 +118,7 @@ by.clicking.on.the.checkbox.in.the.header.row=bằng cách nhấp vào checkbox cancel=Hủy bỏ cancel.all.scheduled.tasks=Hủy tất cả các nhiệm vụ đã lập lịch cancel.cve.service=Hủy dịch vụ CVE +cancel.scheduled.attachment.deletion.from.local.fs=Cancel Scheduled Attachment Deletion From Local FS cannot.add.attachments.before.saving.the.document=Không thể thêm tệp đính kèm trước khi lưu tài liệu cannot.continue.to.merge.of.releases=Không thể tiếp tục hợp nhất các bản phát hành: can.not.get.products=Không thể lấy được sản phẩm! @@ -703,6 +705,7 @@ MainlineState-MAINLINE=Tổ chức hoặc người cho rằng nên sử dụng p MainlineState-OPEN=Không quyết định cho đến nay MainlineState-PHASEOUT=Phần mềm có vấn đề, vui lòng xem xét loại bỏ nó sớm, nếu đang sử dụng. MainlineState-SPECIFIC=Phần mềm không được khuyến nghị nói chung, nhưng đối với trường hợp sử dụng đặc biệt hoặc cho phiên bản cụ thể này thì có thể chấp nhận được. +manual.triggering.of.scheduled.services=Manual triggering of scheduled services matched.by=Phù hợp bởi matching.source.attachments=Kết hợp nguồn đính kèm material.index.number=Số chỉ mục vật liệu @@ -1051,6 +1054,7 @@ scanned=Đã quét scan.the.sources=Quét các nguồn schedule=Kế hoạch schedule.cve.service=Lập lịch dịch vụ CVE +schedule.attachment.deletion.from.local.fs=Schedule Attachment Deletion From Local FS schedule.offset=Lịch trình bù đắp schedule.task.administration=Lịch trình quản lý công việc scope=Scope diff --git a/libraries/lib-datahandler/src/main/java/org/eclipse/sw360/datahandler/thrift/ThriftClients.java b/libraries/lib-datahandler/src/main/java/org/eclipse/sw360/datahandler/thrift/ThriftClients.java index a79e778b6e..1f3b6233f7 100644 --- a/libraries/lib-datahandler/src/main/java/org/eclipse/sw360/datahandler/thrift/ThriftClients.java +++ b/libraries/lib-datahandler/src/main/java/org/eclipse/sw360/datahandler/thrift/ThriftClients.java @@ -84,6 +84,7 @@ public class ThriftClients { // A service which has to be scheduled by the scheduler should be registered here! // names of services that can be scheduled by the schedule service, i.e. that have an "update" method public static final String CVESEARCH_SERVICE = "cvesearchService"; + public static final String DELETE_ATTACHMENT_SERVICE = "deleteattachmentService"; static { Properties props = CommonUtils.loadProperties(ThriftClients.class, PROPERTIES_FILE_PATH); diff --git a/libraries/lib-datahandler/src/main/thrift/attachments.thrift b/libraries/lib-datahandler/src/main/thrift/attachments.thrift index bf9059e01d..1eeb85d9ee 100644 --- a/libraries/lib-datahandler/src/main/thrift/attachments.thrift +++ b/libraries/lib-datahandler/src/main/thrift/attachments.thrift @@ -296,4 +296,9 @@ service AttachmentService { * Returns all attachments usages by release id */ list getAttachmentUsagesByReleaseId(1: string releaseId); + + /** + * calls deleteAttachmentAndDirectory for identifying the file and delete + */ + RequestStatus deleteOldAttachmentFromFileSystem(); }