Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jan Hrabal
jh-boot
Commits
cacd490f
Commit
cacd490f
authored
Oct 04, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attachments
parent
63ff79bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
init.sql
sql/init.sql
+1
-1
FileBasedAttachmentService.java
...va/com/jh/boot/attachment/FileBasedAttachmentService.java
+4
-2
No files found.
sql/init.sql
View file @
cacd490f
...
@@ -229,7 +229,7 @@ CREATE INDEX LEGAL_DOCUMENT_IDX ON LEGAL_DOCUMENT(CODE, LOCALE);
...
@@ -229,7 +229,7 @@ CREATE INDEX LEGAL_DOCUMENT_IDX ON LEGAL_DOCUMENT(CODE, LOCALE);
-- ATTACHMENTS
-- ATTACHMENTS
CREATE
TABLE
ATTACHMENT
(
CREATE
TABLE
ATTACHMENT
(
ID
INT8
NOT
NULL
,
ID
INT8
NOT
NULL
,
UNIT_ID
INT8
NOT
NULL
,
UNIT_ID
INT8
,
OBJECT_TYPE
VARCHAR
(
128
),
OBJECT_TYPE
VARCHAR
(
128
),
OBJECT_ID
INT8
,
OBJECT_ID
INT8
,
...
...
src/main/java/com/jh/boot/attachment/FileBasedAttachmentService.java
View file @
cacd490f
...
@@ -36,7 +36,9 @@ public class FileBasedAttachmentService extends AbstractHibernateAttachmentServi
...
@@ -36,7 +36,9 @@ public class FileBasedAttachmentService extends AbstractHibernateAttachmentServi
protected
File
file
(
Attachment
attachment
)
{
protected
File
file
(
Attachment
attachment
)
{
Objects
.
requireNonNull
(
attachment
,
"Attachment must not be null"
);
Objects
.
requireNonNull
(
attachment
,
"Attachment must not be null"
);
return
Paths
.
get
(
dataDirectory
,
s
(
attachment
.
getUnitId
()),
attachment
.
getObjectType
(),
s
(
attachment
.
getObjectId
()),
attachment
.
getFilename
()).
toFile
();
File
file
=
Paths
.
get
(
dataDirectory
,
s
(
attachment
.
getUnitId
()),
attachment
.
getObjectType
(),
s
(
attachment
.
getObjectId
()),
attachment
.
getFilename
()).
toFile
();
file
.
getParentFile
().
mkdirs
();
return
file
;
}
}
...
@@ -44,7 +46,7 @@ public class FileBasedAttachmentService extends AbstractHibernateAttachmentServi
...
@@ -44,7 +46,7 @@ public class FileBasedAttachmentService extends AbstractHibernateAttachmentServi
return
n
==
null
?
"0"
:
String
.
valueOf
(
n
);
return
n
==
null
?
"0"
:
String
.
valueOf
(
n
);
}
}
@Value
(
"${attachment.
dataDir:/app
/data}"
)
@Value
(
"${attachment.
store.path:/var
/data}"
)
public
void
setDataDirectory
(
String
dataDirectory
)
{
public
void
setDataDirectory
(
String
dataDirectory
)
{
this
.
dataDirectory
=
dataDirectory
;
this
.
dataDirectory
=
dataDirectory
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment