Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
4fc554c2
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4fc554c2
编写于
12月 19, 2010
作者:
M
meyerd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Activiti Cycle: re-enabled download content actions
上级
0419f2b6
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
107 addition
and
63 deletion
+107
-63
modules/activiti-cycle/src/main/java/org/activiti/cycle/ContentRepresentation.java
...c/main/java/org/activiti/cycle/ContentRepresentation.java
+7
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/DownloadContentActionImpl.java
...va/org/activiti/cycle/impl/DownloadContentActionImpl.java
+4
-9
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/action/Actions.java
...src/main/java/org/activiti/cycle/impl/action/Actions.java
+0
-15
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/AbstractPngProvider.java
...impl/connector/signavio/provider/AbstractPngProvider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/ActivitiCompliantBpmn20Provider.java
...or/signavio/provider/ActivitiCompliantBpmn20Provider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/Bpmn20Provider.java
...ycle/impl/connector/signavio/provider/Bpmn20Provider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/EmbeddableModelProvider.java
.../connector/signavio/provider/EmbeddableModelProvider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/Jpdl4Provider.java
...cycle/impl/connector/signavio/provider/Jpdl4Provider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/JsonProvider.java
.../cycle/impl/connector/signavio/provider/JsonProvider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/SignavioDiffProvider.java
...mpl/connector/signavio/provider/SignavioDiffProvider.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/SvgApiProvider.java
...ycle/impl/connector/signavio/provider/SvgApiProvider.java
+7
-2
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/representation/AbstractBasicArtifactTypeContentRepresentation.java
...ation/AbstractBasicArtifactTypeContentRepresentation.java
+4
-0
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/service/CycleContentServiceImpl.java
.../activiti/cycle/impl/service/CycleContentServiceImpl.java
+7
-4
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/service/CyclePluginServiceImpl.java
...g/activiti/cycle/impl/service/CyclePluginServiceImpl.java
+16
-5
modules/activiti-cycle/src/main/java/org/activiti/cycle/service/CycleContentService.java
.../java/org/activiti/cycle/service/CycleContentService.java
+19
-7
modules/activiti-cycle/src/main/java/org/activiti/cycle/service/CyclePluginService.java
...n/java/org/activiti/cycle/service/CyclePluginService.java
+1
-1
modules/activiti-cycle/src/test/java/org/activiti/cycle/impl/connector/fs/FileSystemConnectorTest.java
...viti/cycle/impl/connector/fs/FileSystemConnectorTest.java
+1
-3
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/cycle/ArtifactGet.java
...rc/main/java/org/activiti/rest/api/cycle/ArtifactGet.java
+13
-17
未找到文件。
modules/activiti-cycle/src/main/java/org/activiti/cycle/ContentRepresentation.java
浏览文件 @
4fc554c2
...
...
@@ -2,6 +2,7 @@ package org.activiti.cycle;
import
java.io.Serializable
;
import
org.activiti.cycle.action.DownloadContentAction
;
/**
* TODO: javadoc
...
...
@@ -42,6 +43,12 @@ public interface ContentRepresentation extends Serializable {
*/
public
RepositoryArtifactType
getRepositoryArtifactType
();
/**
* Indicates whether cycle should create a {@link DownloadContentAction} for
* this content representation.
*/
public
boolean
isForDownload
();
// TODO: Think about that, maybe as annotation in the Plugin-Config
// public boolean isDownloadable();
}
\ No newline at end of file
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/DownloadContentActionImpl.java
浏览文件 @
4fc554c2
...
...
@@ -11,21 +11,16 @@ import org.activiti.cycle.action.DownloadContentAction;
*
* @author ruecker
*/
//@CycleComponent(context = CycleContextType.APPLICATION)
// not a @CycleComponent, instantiated by the cycle plugin service for each
// ContentRepresentation
public
class
DownloadContentActionImpl
extends
AbstractArtifactActionImpl
implements
DownloadContentAction
{
private
static
final
long
serialVersionUID
=
1L
;
private
final
ContentRepresentation
contentRepresentation
;
// public DownloadContentActionImpl(ContentRepresentation
// contentRepresentation) {
// this.contentRepresentation = contentRepresentation;
// }
public
DownloadContentActionImpl
()
{
super
(
"Download"
);
this
.
contentRepresentation
=
null
;
public
DownloadContentActionImpl
(
ContentRepresentation
contentRepresentation
)
{
this
(
"Download "
+
contentRepresentation
.
getId
(),
contentRepresentation
);
}
public
DownloadContentActionImpl
(
String
actionId
,
ContentRepresentation
contentRepresentation
)
{
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/action/Actions.java
浏览文件 @
4fc554c2
...
...
@@ -9,7 +9,6 @@ import org.activiti.cycle.CycleComponentFactory;
import
org.activiti.cycle.RepositoryArtifactType
;
import
org.activiti.cycle.action.Action
;
import
org.activiti.cycle.action.CreateUrlAction
;
import
org.activiti.cycle.action.DownloadContentAction
;
import
org.activiti.cycle.action.ParameterizedAction
;
import
org.activiti.cycle.annotations.CycleComponent
;
import
org.activiti.cycle.context.CycleApplicationContext
;
...
...
@@ -27,10 +26,8 @@ public class Actions {
private
Set
<
ParameterizedAction
>
globalParameterizedActions
=
new
HashSet
<
ParameterizedAction
>();
private
Set
<
CreateUrlAction
>
globalCreateUrlActions
=
new
HashSet
<
CreateUrlAction
>();
private
Set
<
DownloadContentAction
>
globalDownloadContentActions
=
new
HashSet
<
DownloadContentAction
>();
private
Map
<
RepositoryArtifactType
,
Set
<
ParameterizedAction
>>
parameterizedActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
ParameterizedAction
>>();
private
Map
<
RepositoryArtifactType
,
Set
<
CreateUrlAction
>>
createUrlActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
CreateUrlAction
>>();
private
Map
<
RepositoryArtifactType
,
Set
<
DownloadContentAction
>>
downloadContentActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
DownloadContentAction
>>();
public
Set
<
ParameterizedAction
>
getParameterizedActions
(
RepositoryArtifactType
forType
)
{
ensureMapInitialized
();
...
...
@@ -42,16 +39,6 @@ public class Actions {
return
resultSet
;
}
public
Set
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifactType
forType
)
{
ensureMapInitialized
();
Set
<
DownloadContentAction
>
resultSet
=
new
HashSet
<
DownloadContentAction
>(
globalDownloadContentActions
);
Set
<
DownloadContentAction
>
actionsForThisType
=
downloadContentActionsMap
.
get
(
forType
);
if
(
actionsForThisType
!=
null
)
{
resultSet
.
addAll
(
actionsForThisType
);
}
return
resultSet
;
}
public
Set
<
CreateUrlAction
>
getCreateUrlActions
(
RepositoryArtifactType
forType
)
{
ensureMapInitialized
();
Set
<
CreateUrlAction
>
resultSet
=
new
HashSet
<
CreateUrlAction
>(
globalCreateUrlActions
);
...
...
@@ -70,10 +57,8 @@ public class Actions {
}
parameterizedActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
ParameterizedAction
>>();
createUrlActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
CreateUrlAction
>>();
downloadContentActionsMap
=
new
HashMap
<
RepositoryArtifactType
,
Set
<
DownloadContentAction
>>();
loadMap
(
parameterizedActionsMap
,
globalParameterizedActions
,
ParameterizedAction
.
class
);
loadMap
(
createUrlActionsMap
,
globalCreateUrlActions
,
CreateUrlAction
.
class
);
loadMap
(
downloadContentActionsMap
,
globalDownloadContentActions
,
DownloadContentAction
.
class
);
initialized
=
true
;
}
}
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/AbstractPngProvider.java
浏览文件 @
4fc554c2
...
...
@@ -57,5 +57,9 @@ public abstract class AbstractPngProvider extends SignavioContentRepresentationP
public
RenderInfo
getRenderInfo
()
{
return
RenderInfo
.
IMAGE
;
}
public
boolean
isForDownload
()
{
return
true
;
}
}
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/ActivitiCompliantBpmn20Provider.java
浏览文件 @
4fc554c2
...
...
@@ -68,6 +68,10 @@ public class ActivitiCompliantBpmn20Provider extends SignavioContentRepresentati
public
RepositoryArtifactType
getRepositoryArtifactType
()
{
return
CycleApplicationContext
.
get
(
SignavioBpmn20ArtifactType
.
class
);
}
public
boolean
isForDownload
()
{
return
true
;
}
public
static
String
createBpmnXml
(
RepositoryConnector
connector
,
RepositoryArtifact
artifact
)
{
String
sourceJson
=
getBpmn20Json
(
artifact
);
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/Bpmn20Provider.java
浏览文件 @
4fc554c2
...
...
@@ -62,6 +62,10 @@ public class Bpmn20Provider extends SignavioContentRepresentationProvider {
throw
new
RepositoryException
(
"Error while accessing Signavio repository"
,
ex
);
}
}
public
boolean
isForDownload
()
{
return
true
;
}
public
String
getId
()
{
return
NAME
;
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/EmbeddableModelProvider.java
浏览文件 @
4fc554c2
...
...
@@ -62,6 +62,10 @@ public class EmbeddableModelProvider extends SignavioContentRepresentationProvid
// TODO: ?
return
RenderInfo
.
HTML
;
}
public
boolean
isForDownload
()
{
return
false
;
}
public
MimeType
getRepresentationMimeType
()
{
return
CycleApplicationContext
.
get
(
HtmlMimeType
.
class
);
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/Jpdl4Provider.java
浏览文件 @
4fc554c2
...
...
@@ -67,6 +67,10 @@ public class Jpdl4Provider extends SignavioContentRepresentationProvider {
public
RenderInfo
getRenderInfo
()
{
return
RenderInfo
.
CODE
;
}
public
boolean
isForDownload
()
{
return
true
;
}
public
RepositoryArtifactType
getRepositoryArtifactType
()
{
return
CycleApplicationContext
.
get
(
SignavioJpdl4ArtifactType
.
class
);
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/JsonProvider.java
浏览文件 @
4fc554c2
...
...
@@ -62,6 +62,10 @@ public class JsonProvider extends SignavioContentRepresentationProvider {
public
RenderInfo
getRenderInfo
()
{
return
RenderInfo
.
CODE
;
}
public
boolean
isForDownload
()
{
return
true
;
}
public
RepositoryArtifactType
getRepositoryArtifactType
()
{
return
CycleApplicationContext
.
get
(
SignavioBpmn20ArtifactType
.
class
);
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/SignavioDiffProvider.java
浏览文件 @
4fc554c2
...
...
@@ -60,6 +60,10 @@ public class SignavioDiffProvider extends SignavioContentRepresentationProvider
public
RepositoryArtifactType
getRepositoryArtifactType
()
{
return
CycleApplicationContext
.
get
(
SignavioBpmn20ArtifactType
.
class
);
}
public
boolean
isForDownload
()
{
return
false
;
}
public
Content
getContent
(
RepositoryArtifact
artifact
)
{
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/connector/signavio/provider/SvgApiProvider.java
浏览文件 @
4fc554c2
...
...
@@ -21,7 +21,8 @@ public class SvgApiProvider extends SignavioContentRepresentationProvider {
private
static
final
long
serialVersionUID
=
1L
;
public
Content
getContent
(
RepositoryArtifact
artifact
)
{
SignavioConnectorInterface
signavioConnector
=
(
SignavioConnectorInterface
)
CycleSessionContext
.
get
(
RuntimeConnectorList
.
class
).
getConnectorById
(
artifact
.
getConnectorId
());
SignavioConnectorInterface
signavioConnector
=
(
SignavioConnectorInterface
)
CycleSessionContext
.
get
(
RuntimeConnectorList
.
class
).
getConnectorById
(
artifact
.
getConnectorId
());
Content
content
=
new
Content
();
String
text
=
new
SignavioSvgApiBuilder
(
signavioConnector
,
artifact
).
buildHtml
();
content
.
setValue
(
text
);
...
...
@@ -31,7 +32,7 @@ public class SvgApiProvider extends SignavioContentRepresentationProvider {
public
String
getId
()
{
return
"SvgApi"
;
}
public
MimeType
getRepresentationMimeType
()
{
return
CycleApplicationContext
.
get
(
HtmlMimeType
.
class
);
}
...
...
@@ -44,4 +45,8 @@ public class SvgApiProvider extends SignavioContentRepresentationProvider {
return
CycleApplicationContext
.
get
(
SignavioBpmn20ArtifactType
.
class
);
}
public
boolean
isForDownload
()
{
return
false
;
}
}
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/representation/AbstractBasicArtifactTypeContentRepresentation.java
浏览文件 @
4fc554c2
...
...
@@ -42,4 +42,8 @@ public abstract class AbstractBasicArtifactTypeContentRepresentation implements
return
true
;
}
public
boolean
isForDownload
()
{
return
true
;
}
}
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/service/CycleContentServiceImpl.java
浏览文件 @
4fc554c2
...
...
@@ -52,8 +52,7 @@ public class CycleContentServiceImpl implements CycleContentService {
return
CycleApplicationContext
.
get
(
Transformations
.
class
).
transformContent
(
content
,
fromType
,
toType
);
}
public
List
<
ContentRepresentation
>
getcontentRepresentations
(
RepositoryArtifact
artifact
)
{
RepositoryArtifactType
type
=
artifact
.
getArtifactType
();
public
List
<
ContentRepresentation
>
getContentRepresentations
(
RepositoryArtifactType
type
)
{
Set
<
ContentRepresentation
>
representations
=
CycleApplicationContext
.
get
(
ContentRepresentations
.
class
).
getContentRepresentations
(
type
);
removeExcludedContentRepresentations
(
representations
);
List
<
ContentRepresentation
>
sortedList
=
new
ArrayList
<
ContentRepresentation
>(
representations
);
...
...
@@ -61,16 +60,20 @@ public class CycleContentServiceImpl implements CycleContentService {
return
sortedList
;
}
public
List
<
ContentRepresentation
>
getContentRepresentations
(
RepositoryArtifact
artifact
)
{
return
getContentRepresentations
(
artifact
.
getArtifactType
());
}
private
void
sortContentReprsentations
(
List
<
ContentRepresentation
>
sortedList
)
{
Collections
.
sort
(
sortedList
,
new
CycleComponentComparator
());
}
private
void
removeExcludedContentRepresentations
(
Set
<
?
>
represenations
)
{
private
void
removeExcludedContentRepresentations
(
Set
<
?
>
represenations
)
{
CycleComponentFactory
.
removeExcludedComponents
(
represenations
);
}
public
ContentRepresentation
getContentRepresentation
(
RepositoryArtifact
artifact
,
String
contentRepresentationId
)
{
List
<
ContentRepresentation
>
representations
=
get
c
ontentRepresentations
(
artifact
);
List
<
ContentRepresentation
>
representations
=
get
C
ontentRepresentations
(
artifact
);
for
(
ContentRepresentation
contentRepresentation
:
representations
)
{
if
(!
contentRepresentation
.
getId
().
equals
(
contentRepresentationId
))
{
continue
;
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/impl/service/CyclePluginServiceImpl.java
浏览文件 @
4fc554c2
...
...
@@ -7,6 +7,7 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Set
;
import
org.activiti.cycle.ContentRepresentation
;
import
org.activiti.cycle.CycleComponentFactory
;
import
org.activiti.cycle.RepositoryArtifact
;
import
org.activiti.cycle.RepositoryArtifactType
;
...
...
@@ -20,8 +21,10 @@ import org.activiti.cycle.components.RuntimeConnectorList;
import
org.activiti.cycle.context.CycleApplicationContext
;
import
org.activiti.cycle.context.CycleSessionContext
;
import
org.activiti.cycle.impl.CycleComponentComparator
;
import
org.activiti.cycle.impl.DownloadContentActionImpl
;
import
org.activiti.cycle.impl.action.Actions
;
import
org.activiti.cycle.service.CyclePluginService
;
import
org.activiti.cycle.service.CycleServiceFactory
;
/**
* Default Implementation of the {@link CyclePluginService}
...
...
@@ -39,8 +42,17 @@ public class CyclePluginServiceImpl implements CyclePluginService {
}
public
Set
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifactType
type
)
{
return
CycleApplicationContext
.
get
(
Actions
.
class
).
getDownloadContentActions
(
type
);
public
List
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifactType
type
)
{
List
<
DownloadContentAction
>
actions
=
new
ArrayList
<
DownloadContentAction
>();
List
<
ContentRepresentation
>
contentRepresentations
=
CycleServiceFactory
.
getContentService
().
getContentRepresentations
(
type
);
// will be sorted according to the sort on the represenations
for
(
ContentRepresentation
representation
:
contentRepresentations
)
{
if
(
representation
.
isForDownload
())
{
actions
.
add
(
new
DownloadContentActionImpl
(
representation
));
}
}
return
actions
;
}
public
List
<
ParameterizedAction
>
getParameterizedActions
(
RepositoryArtifact
artifact
)
{
...
...
@@ -57,9 +69,8 @@ public class CyclePluginServiceImpl implements CyclePluginService {
}
public
List
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifact
artifact
)
{
Set
<
DownloadContentAction
>
actions
=
getDownloadContentActions
(
artifact
.
getArtifactType
());
removeExcludedActions
(
actions
);
return
sortActions
(
actions
,
artifact
);
List
<
DownloadContentAction
>
actions
=
getDownloadContentActions
(
artifact
.
getArtifactType
());
return
actions
;
}
private
void
removeNonApplicableActions
(
Set
<
ParameterizedAction
>
actions
,
RepositoryArtifact
forArtifact
)
{
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/service/CycleContentService.java
浏览文件 @
4fc554c2
...
...
@@ -31,22 +31,34 @@ public interface CycleContentService {
public
Set
<
RepositoryArtifactType
>
getAvailableArtifactTypes
();
/**
* Returns a
se
t of available content representations for the provided
* Returns a
Lis
t of available content representations for the provided
* {@link RepositoryArtifact}
*
* @param
type
* @return a {@link
Se
t} of {@link ContentRepresentation}s for the provided
* @param
artifact
* @return a {@link
Lis
t} of {@link ContentRepresentation}s for the provided
* {@link RepositoryArtifact}. Returns an empty {@link Set} if no
* {@link ContentRepresentation}s are available.
*/
public
List
<
ContentRepresentation
>
getcontentRepresentations
(
RepositoryArtifact
artifact
);
public
List
<
ContentRepresentation
>
getContentRepresentations
(
RepositoryArtifact
artifact
);
/**
* Returns a List of available content representations for the provided
* {@link RepositoryArtifactType}
*
* @param type
* @return a {@link List} of {@link ContentRepresentation}s for the provided
* {@link RepositoryArtifactType}. Returns an empty {@link List} if no
* {@link ContentRepresentation}s are available.
*/
public
List
<
ContentRepresentation
>
getContentRepresentations
(
RepositoryArtifactType
type
);
/**
* Return the {@link ContentRepresentation} for a provided
{@link RepositoryArtifact} and a
* contentRepresentationId.
* Return the {@link ContentRepresentation} for a provided
*
{@link RepositoryArtifact} and a
contentRepresentationId.
*
* @param artifact
* the {@link RepositoryArtifact} to retrieve the {@link ContentRepresentation} for
* the {@link RepositoryArtifact} to retrieve the
* {@link ContentRepresentation} for
* @param contentRepresentationId
* the string of the corresponding {@link ContentRepresentation}
* @return {@link ContentRepresentation}
...
...
modules/activiti-cycle/src/main/java/org/activiti/cycle/service/CyclePluginService.java
浏览文件 @
4fc554c2
...
...
@@ -23,7 +23,7 @@ public interface CyclePluginService {
public
Set
<
CreateUrlAction
>
getCreateUrlActions
(
RepositoryArtifactType
type
);
public
Se
t
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifactType
type
);
public
Lis
t
<
DownloadContentAction
>
getDownloadContentActions
(
RepositoryArtifactType
type
);
public
List
<
ParameterizedAction
>
getParameterizedActions
(
RepositoryArtifact
artifact
);
...
...
modules/activiti-cycle/src/test/java/org/activiti/cycle/impl/connector/fs/FileSystemConnectorTest.java
浏览文件 @
4fc554c2
...
...
@@ -2,9 +2,7 @@ package org.activiti.cycle.impl.connector.fs;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.logging.Logger
;
import
org.activiti.cycle.Content
;
...
...
@@ -52,7 +50,7 @@ public class FileSystemConnectorTest {
if
(
repositoryNode
instanceof
RepositoryArtifact
)
{
RepositoryArtifact
artifact
=
(
RepositoryArtifact
)
repositoryNode
;
List
<
ContentRepresentation
>
contentRepresentations
=
contentService
.
get
c
ontentRepresentations
(
artifact
);
List
<
ContentRepresentation
>
contentRepresentations
=
contentService
.
get
C
ontentRepresentations
(
artifact
);
for
(
ContentRepresentation
contentRepresentation
:
contentRepresentations
)
{
Content
content
=
conn
.
getContent
(
artifact
.
getNodeId
());
System
.
out
.
println
(
contentRepresentation
.
getId
()
+
" -> "
+
content
.
asString
());
...
...
modules/activiti-webapp-rest/src/main/java/org/activiti/rest/api/cycle/ArtifactGet.java
浏览文件 @
4fc554c2
...
...
@@ -21,15 +21,11 @@ import java.util.Map;
import
org.activiti.cycle.ContentRepresentation
;
import
org.activiti.cycle.RepositoryArtifact
;
import
org.activiti.cycle.action.DownloadContentAction
;
import
org.activiti.cycle.service.CycleContentService
;
import
org.activiti.cycle.service.CyclePluginService
;
import
org.activiti.cycle.service.CycleServiceFactory
;
import
org.activiti.rest.api.cycle.dto.DownloadActionView
;
import
org.activiti.rest.util.ActivitiRequest
;
import
org.springframework.extensions.webscripts.Cache
;
import
org.springframework.extensions.webscripts.Status
;
/**
*
* @author Nils Preusker (nils.preusker@camunda.com)
...
...
@@ -51,7 +47,7 @@ public class ArtifactGet extends ActivitiCycleWebScript {
RepositoryArtifact
artifact
=
repositoryService
.
getRepositoryArtifact
(
connectorId
,
artifactId
);
List
<
String
>
contentRepresentations
=
new
ArrayList
<
String
>();
for
(
ContentRepresentation
representation
:
contentService
.
get
c
ontentRepresentations
(
artifact
))
{
for
(
ContentRepresentation
representation
:
contentService
.
get
C
ontentRepresentations
(
artifact
))
{
contentRepresentations
.
add
(
representation
.
getId
());
}
...
...
@@ -61,18 +57,18 @@ public class ArtifactGet extends ActivitiCycleWebScript {
// Create downloadContentView DTOs
List
<
DownloadActionView
>
downloads
=
new
ArrayList
<
DownloadActionView
>();
//
for (DownloadContentAction action : pluginService.getDownloadContentActions(artifact)) {
//
try {
//
String url = restProxyUri + "content?connectorId=" + URLEncoder.encode(connectorId, "UTF-8") + "&artifactId=" + URLEncoder.encode(artifactId, "UTF-8")
//
+ "&contentRepresentationId=" + URLEncoder.encode(action.getContentRepresentation().getId(), "UTF-8");
// downloads.add(new DownloadActionView(action.getId(), url, action.getContentRepresentation().get
MimeType().getContentType(), action
//
.getContentRepresentation().getId()));
//
} catch (UnsupportedEncodingException e) {
//
// should never be reached as long as we use UTF-8, which is valid in
//
// java on all platforms
//
throw new RuntimeException(e);
//
}
//
}
for
(
DownloadContentAction
action
:
pluginService
.
getDownloadContentActions
(
artifact
))
{
try
{
String
url
=
restProxyUri
+
"content?connectorId="
+
URLEncoder
.
encode
(
connectorId
,
"UTF-8"
)
+
"&artifactId="
+
URLEncoder
.
encode
(
artifactId
,
"UTF-8"
)
+
"&contentRepresentationId="
+
URLEncoder
.
encode
(
action
.
getContentRepresentation
().
getId
(),
"UTF-8"
);
downloads
.
add
(
new
DownloadActionView
(
action
.
getId
(),
url
,
action
.
getContentRepresentation
().
getRepresentation
MimeType
().
getContentType
(),
action
.
getContentRepresentation
().
getId
()));
}
catch
(
UnsupportedEncodingException
e
)
{
// should never be reached as long as we use UTF-8, which is valid in
// java on all platforms
throw
new
RuntimeException
(
e
);
}
}
model
.
put
(
"downloads"
,
downloads
);
model
.
put
(
"links"
,
pluginService
.
getArtifactOpenLinkActions
(
artifact
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录