提交 e22a64ce 编写于 作者: B bernd.ruecker

Refactored Artifact.ID, now we have 'connectorId', 'originalNodeId',...

Refactored Artifact.ID, now we have 'connectorId', 'originalNodeId', 'currentPath' and 'globalUniqueId'
Added ID for repositoryConnectorConfigurations
Fixed bug in Signavio Connector to let it fail in log level FINE
Added missing httpclient jars to web-app in demo setup (caused by new restlet version)
上级 5151c187
......@@ -129,7 +129,9 @@
<include name="scannotation-*.jar"/>
<include name="javassist-*.jar"/>
<include name="signavio-core-components-*.jar"/>
<include name="jaxb-impl-*.jar"/>
<include name="jaxb-impl-*.jar"/>
<include name="httpclient-*.jar" />
<include name="httpcore-*.jar" />
</fileset>
</copy>
......
......@@ -33,18 +33,17 @@ insert into ACT_CY_CONFIG values ('kermit', '<org.activiti.cycle.impl.conf.Confi
<name>kermit</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>@activiti.modeler.base.url@</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
<name>Demo</name>
</org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
</linkedConnectors>
<parentContainers/>
</org.activiti.cycle.impl.conf.ConfigurationContainer>', 1);
......@@ -52,12 +51,14 @@ insert into ACT_CY_CONFIG values ('fozzie', '<org.activiti.cycle.impl.conf.Confi
<name>fozzie</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>@activiti.modeler.base.url@</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......@@ -68,12 +69,14 @@ insert into ACT_CY_CONFIG values ('gonzo', '<org.activiti.cycle.impl.conf.Config
<name>gonzo</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>http://localhost:8080/activiti-modeler/</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......
......@@ -32,18 +32,17 @@ insert into ACT_CY_CONFIG values ('kermit', '<org.activiti.cycle.impl.conf.Confi
<name>kermit</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>@activiti.modeler.base.url@</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
<name>Demo</name>
</org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
</linkedConnectors>
<parentContainers/>
</org.activiti.cycle.impl.conf.ConfigurationContainer>', 1);
......@@ -51,12 +50,14 @@ insert into ACT_CY_CONFIG values ('fozzie', '<org.activiti.cycle.impl.conf.Confi
<name>fozzie</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>@activiti.modeler.base.url@</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......@@ -67,12 +68,14 @@ insert into ACT_CY_CONFIG values ('gonzo', '<org.activiti.cycle.impl.conf.Config
<name>gonzo</name>
<linkedConnectors>
<org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<id>Activiti</id>
<name>Activiti Modeler</name>
<credentialsSaved>false</credentialsSaved>
<signavioBaseUrl>http://localhost:8080/activiti-modeler/</signavioBaseUrl>
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......
......@@ -39,13 +39,11 @@ insert into ACT_CY_CONFIG values ('kermit', '<org.activiti.cycle.impl.conf.Confi
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
<name>Demo</name>
</org.activiti.cycle.impl.connector.demo.DemoConnectorConfiguration>
</linkedConnectors>
</linkedConnectors>
<parentContainers/>
</org.activiti.cycle.impl.conf.ConfigurationContainer>', 1);
insert into ACT_CY_CONFIG values ('fozzie', '<org.activiti.cycle.impl.conf.ConfigurationContainer>
......@@ -58,6 +56,7 @@ insert into ACT_CY_CONFIG values ('fozzie', '<org.activiti.cycle.impl.conf.Confi
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......@@ -74,6 +73,7 @@ insert into ACT_CY_CONFIG values ('gonzo', '<org.activiti.cycle.impl.conf.Config
<loginRequired>false</loginRequired>
</org.activiti.cycle.impl.connector.signavio.SignavioConnectorConfiguration>
<org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
<id>Workspace</id>
<name>Eclipse Workspace (File System)</name>
<baseFilePath>@cycle.base.file.path@</baseFilePath>
</org.activiti.cycle.impl.connector.fs.FileSystemConnectorConfiguration>
......
......@@ -46,7 +46,7 @@ public interface ArtifactType {
public ParameterizedAction getParameterizedAction(String name);
public List<RepositoryArtifactOutgoingLink> createLinks(RepositoryConnector connector, RepositoryArtifact artifact);
public List<RepositoryArtifactOpenLinkAction> createOpenLinkActions(RepositoryConnector connector, RepositoryArtifact artifact);
public List<DownloadContentAction> getDownloadContentActions();
......
......@@ -25,5 +25,5 @@ public interface RepositoryArtifact extends RepositoryNode {
public ArtifactType getArtifactType();
public List<RepositoryArtifactOutgoingLink> getOutgoingLinks();
public List<RepositoryArtifactOpenLinkAction> getOpenLinkActions();
}
......@@ -3,15 +3,17 @@ package org.activiti.cycle;
import java.net.URL;
/**
* Action to open an external URl for an {@link RepositoryArtifact}, for example
* opening the Signavio modeler for a BPMN model
*
* @author ruecker
*/
public class RepositoryArtifactOutgoingLink {
public class RepositoryArtifactOpenLinkAction {
private String id;
private URL url;
public RepositoryArtifactOutgoingLink(String id, URL url) {
public RepositoryArtifactOpenLinkAction(String id, URL url) {
this.id = id;
this.url = url;
}
......
......@@ -12,6 +12,8 @@
*/
package org.activiti.cycle;
import org.activiti.cycle.impl.connector.view.RootConnector;
/**
* Superclass for the composite of folders and files. Holds a reference to the
......@@ -28,22 +30,51 @@ public interface RepositoryNode {
* details can be queried by this URL later on, by adding the repo base URL to
* the beginning.
*
*
* TODO: When thinking about Metadata-Persietnce, maybe introduce an UUID?
* TODO: Maybe use BASE 64 Encoding for GUI, where do we put that?
*/
/**
* ID of the {@link RepositoryConnector} this {@link RepositoryNode}
* originally "belongs" to.
*/
public String getConnectorId();
/**
* <b>The current path is used in the {@link RepositoryConnector}-API, so if
* you don't have a special use case use that, not this one!</b>
*
* Unique ID of the {@link RepositoryNode} within the original
* {@link RepositoryConnector} identified by the connectorId.
*
* For Signavio the ID is simply an UUID generated by Signavio. For FileSystem
* this is the "local" part of the absolute path of the file WITHOUT the
* configured root folder of the FileSystem connector. For other repos this
* may be whatever it needs to be, the client shouldn't really care.
*
* TODO: When thinking about Metadata-Persietnce, maybe introduce an UUID?
* TODO: Maybe use BASE 64 Encoding for GUI, where do we put that?
*/
public String getId();
public String getOriginalNodeId();
// public String get
/**
* <b>The current path is used in the {@link RepositoryConnector}-API, so if
* you don't have a special use case use that, not this one!</b>
*
* ID composed of the connectorId and the node id, which results in a Cycle
* wide unique ID for an {@link RepositoryNode}
*/
public String getGlobalUniqueId();
// /**
// * The url used in the client (e.g. GUI) for this artifact
// */
// public String getClientUrl();
/**
* <b>The current path is used in the {@link RepositoryConnector}-API, so if
* you don't have a special use case use this one!</b>
*
* current path of artifact in the current "context", so for example the id of
* the artifact when using the {@link RootConnector} or maybe another
* accumulating connector like tags, ... This ID is <b>NOT</b> globally unique
* and just always used in one special context. It may even be changed by
* connectors like the {@link RootConnector} on the fly.
*/
public String getCurrentPath();
public RepositoryNodeMetadata getMetadata();
}
......@@ -21,14 +21,14 @@ import org.activiti.cycle.ArtifactType;
import org.activiti.cycle.ContentProvider;
import org.activiti.cycle.ContentRepresentation;
import org.activiti.cycle.CreateUrlAction;
import org.activiti.cycle.CycleDefaultMimeType;
import org.activiti.cycle.DownloadContentAction;
import org.activiti.cycle.MimeType;
import org.activiti.cycle.ParameterizedAction;
import org.activiti.cycle.RepositoryArtifact;
import org.activiti.cycle.RepositoryArtifactOutgoingLink;
import org.activiti.cycle.RepositoryArtifactOpenLinkAction;
import org.activiti.cycle.RepositoryConnector;
import org.activiti.cycle.RepositoryException;
import org.activiti.cycle.CycleDefaultMimeType;
/**
* The type specifies the type of an artifact, e.g. Signavio model, jpdl process
......@@ -304,10 +304,10 @@ public class ArtifactTypeImpl implements ArtifactType {
downloadContentActions.add(new DownloadContentActionImpl(getContentRepresentation(contentRepresentationId)));
}
public List<RepositoryArtifactOutgoingLink> createLinks(RepositoryConnector connector, RepositoryArtifact artifact) {
ArrayList<RepositoryArtifactOutgoingLink> list = new ArrayList<RepositoryArtifactOutgoingLink>();
public List<RepositoryArtifactOpenLinkAction> createOpenLinkActions(RepositoryConnector connector, RepositoryArtifact artifact) {
ArrayList<RepositoryArtifactOpenLinkAction> list = new ArrayList<RepositoryArtifactOpenLinkAction>();
for (CreateUrlAction action : getCreateUrlActions()) {
RepositoryArtifactOutgoingLink link = new RepositoryArtifactOutgoingLink(action.getId(), action.getUrl(connector, artifact));
RepositoryArtifactOpenLinkAction link = new RepositoryArtifactOpenLinkAction(action.getId(), action.getUrl(connector, artifact));
list.add(link);
}
return list;
......
......@@ -35,7 +35,7 @@ public abstract class ContentProviderImpl implements ContentProvider {
addValueToContent(c, connector, artifact);
if (c.isNull()) {
throw new RepositoryException("No content created for artifact " + artifact.getId() + " ' by provider '" + this.getClass().getName()
throw new RepositoryException("No content created for artifact " + artifact.getGlobalUniqueId() + " ' by provider '" + this.getClass().getName()
+ "' (was null). Please check provider or artifact.");
}
......
......@@ -16,7 +16,7 @@ import java.util.List;
import org.activiti.cycle.ArtifactType;
import org.activiti.cycle.RepositoryArtifact;
import org.activiti.cycle.RepositoryArtifactOutgoingLink;
import org.activiti.cycle.RepositoryArtifactOpenLinkAction;
import org.activiti.cycle.RepositoryConnector;
/**
......@@ -31,16 +31,17 @@ public class RepositoryArtifactImpl extends RepositoryNodeImpl implements Reposi
private final ArtifactType artifactType;
private final List<RepositoryArtifactOutgoingLink> links;
private final List<RepositoryArtifactOpenLinkAction> openLinkActions;
public RepositoryArtifactImpl(String id, ArtifactType artifactType, RepositoryConnector connector) {
super(id);
public RepositoryArtifactImpl(String connectorId, String nodeId, ArtifactType artifactType, RepositoryConnector connector) {
super(connectorId, nodeId);
this.artifactType = artifactType;
this.links = artifactType.createLinks(connector, this);
this.openLinkActions = artifactType.createOpenLinkActions(connector, this);
}
public String toString() {
return this.getClass().getSimpleName() + " [id=" + getId() + ";type=" + artifactType + ";metadata=" + getMetadata() + "]";
return this.getClass().getSimpleName() + " [connectorId=" + getConnectorId() + ";artifactId=" + getOriginalNodeId() + ";type=" + artifactType + ";metadata="
+ getMetadata() + "]";
}
......@@ -48,7 +49,7 @@ public class RepositoryArtifactImpl extends RepositoryNodeImpl implements Reposi
return artifactType;
}
public List<RepositoryArtifactOutgoingLink> getOutgoingLinks() {
return links;
public List<RepositoryArtifactOpenLinkAction> getOpenLinkActions() {
return openLinkActions;
}
}
......@@ -23,8 +23,8 @@ public class RepositoryFolderImpl extends RepositoryNodeImpl implements Reposito
private static final long serialVersionUID = 1L;
public RepositoryFolderImpl(String id) {
super(id);
public RepositoryFolderImpl(String connectorId, String nodeId) {
super(connectorId, nodeId);
}
}
......@@ -65,9 +65,12 @@ public class RepositoryNodeCollectionImpl implements RepositoryNodeCollection {
return (getArtifact(id) != null);
}
public RepositoryArtifact getArtifact(String id) {
/**
* TODO: Duoble check that current path is the best option here!
*/
public RepositoryArtifact getArtifact(String currentPath) {
for (RepositoryArtifact file : getArtifactList()) {
if (id.equals(file.getId())) {
if (currentPath.equals(file.getCurrentPath())) {
return file;
}
}
......@@ -87,9 +90,12 @@ public class RepositoryNodeCollectionImpl implements RepositoryNodeCollection {
return (getFolder(id) != null);
}
public RepositoryFolder getFolder(String id) {
/**
* TODO: Duoble check that current path is the best option here!
*/
public RepositoryFolder getFolder(String currentPath) {
for (RepositoryFolder folder : getFolderList()) {
if (id.equals(folder.getId())) {
if (currentPath.equals(folder.getCurrentPath())) {
return folder;
}
}
......
......@@ -16,6 +16,7 @@ import java.io.Serializable;
import java.util.Map;
import java.util.logging.Logger;
import org.activiti.cycle.RepositoryException;
import org.activiti.cycle.RepositoryNode;
import org.activiti.cycle.RepositoryNodeMetadata;
......@@ -31,29 +32,26 @@ public class RepositoryNodeImpl implements RepositoryNode, Serializable {
private static final long serialVersionUID = 1L;
protected Logger log = Logger.getLogger(this.getClass().getName());
/**
* local part of the URL for node. This is the one and only used unique
* identifier for the node used by the client and the repository API. All
* details can be queried by this URL later on, by adding the repo base URL to
* the beginning.
*
* For Signavio the ID is simply an UUID generated by Signavio. For FileSystem
* this is the "local" part of the absolute path of the file WITHOUT the
* configured root folder of the FileSystem connector. For other repos this
* may be whatever it needs to be, the client shouldn't really care.
*/
private String id;
private final RepositoryNodeMetadata metadata = new RepositoryNodeMetadataImpl();
public RepositoryNodeImpl(String id) {
this.id = id;
private final String connectorId;
private final String nodeId;
private String currentPath;
public RepositoryNodeImpl(String connectorId, String nodeId) {
this.connectorId = connectorId;
this.nodeId = nodeId;
// Creating a repositoryNodeImpl is done by the original connector, hence
// the nodeId is already the correct current path:
this.currentPath = nodeId;
}
@Override
public String toString() {
return this.getClass().getSimpleName() + " [id=" + id + ";metadata=" + metadata + "]";
return this.getClass().getSimpleName() + " [connectorId=" + connectorId + ";nodeid=" + nodeId + ";metadata=" + metadata + "]";
}
public RepositoryNodeMetadata getMetadata() {
......@@ -64,12 +62,47 @@ public class RepositoryNodeImpl implements RepositoryNode, Serializable {
return metadata.getAsStringMap();
}
public String getId() {
return id;
/**
* {@inheritDoc}
*/
public String getConnectorId() {
return connectorId;
}
public void setId(String id) {
this.id = id;
/**
* {@inheritDoc}
*/
public String getOriginalNodeId() {
return nodeId;
}
public String getGlobalUniqueId() {
return getConnectorId() + "/" + getOriginalNodeId();
}
public String getCurrentPath() {
if (currentPath == null) {
throw new RepositoryException("current path is unset for " + this + "! Check implementation.");
}
return currentPath;
}
public void setCurrentPath(String currentPath) {
this.currentPath = currentPath;
}
public void addNewRootToCurrentPath(String rootName) {
if (!getCurrentPath().startsWith("/")) {
throw new RepositoryException("RepositoryNode id doesn't start with a slash, which is considered invalid: '" + getCurrentPath() + "' in repository '"
+ getConnectorId() + "'");
} else {
if (rootName.startsWith("/")) {
setCurrentPath(rootName + getCurrentPath());
} else {
setCurrentPath("/" + rootName + getCurrentPath());
}
}
}
}
......@@ -9,7 +9,6 @@ import java.util.Properties;
import org.activiti.cycle.ArtifactType;
import org.activiti.cycle.RepositoryConnector;
import org.activiti.cycle.RepositoryException;
import org.activiti.cycle.impl.connector.signavio.SignavioPluginDefinition;
import org.activiti.cycle.impl.plugin.ActivitiCyclePluginDefinition;
/**
......@@ -22,6 +21,8 @@ public abstract class RepositoryConnectorConfiguration {
*
* TODO: Use this default? Hmm....
*/
private String id = this.getClass().getSimpleName().replace("Configuration", "");
private String name = this.getClass().getSimpleName().replace("Configuration", "");
// /**
......@@ -137,6 +138,15 @@ public abstract class RepositoryConnectorConfiguration {
this.description = description;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
// @Override
// public String toString() {
// return "RepositoryConnectorConfiguration '" +
......
......@@ -52,7 +52,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
RepositoryArtifact file2 = createArtifact("/minutes", "InitialMindmap.mm", DemoConnectorPluginDefinition.ARTIFACT_TYPE_MINDMAP,
createContent("/org/activiti/cycle/impl/connector/demo/mindmap.html"));
addContentToInternalMap(file2.getId(), DemoConnectorPluginDefinition.CONTENT_REPRESENTATION_ID_PNG,
addContentToInternalMap(file2.getOriginalNodeId(), DemoConnectorPluginDefinition.CONTENT_REPRESENTATION_ID_PNG,
createContent(
"/org/activiti/cycle/impl/connector/demo/mindmap.jpg").asByteArray());
......@@ -66,7 +66,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
RepositoryArtifact file3 = createArtifactFromContentRepresentation("/BPMN/Level3", "InitialBpmnModel", DemoConnectorPluginDefinition.ARTIFACT_TYPE_BPMN_20,
DemoConnectorPluginDefinition.CONTENT_REPRESENTATION_ID_XML,
createContent("/org/activiti/cycle/impl/connector/demo/engine-pool.xml"));
addContentToInternalMap(file3.getId(), DemoConnectorPluginDefinition.CONTENT_REPRESENTATION_ID_PNG, createContent(
addContentToInternalMap(file3.getOriginalNodeId(), DemoConnectorPluginDefinition.CONTENT_REPRESENTATION_ID_PNG, createContent(
"/org/activiti/cycle/impl/connector/demo/bpmn.png").asByteArray());
rootNodes.add(folder2);
......@@ -84,15 +84,15 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
}
public void copyArtifact(RepositoryArtifact artifact, String targetName) {
RepositoryArtifact copy = new RepositoryArtifactImpl(targetName, artifact.getArtifactType(), this);
RepositoryArtifact copy = new RepositoryArtifactImpl(getConfiguration().getId(), targetName, artifact.getArtifactType(), this);
nodes.add(copy);
Collection<ContentRepresentation> contentRepresentationDefinitions = artifact.getArtifactType().getContentRepresentations();
for (ContentRepresentation def : contentRepresentationDefinitions) {
def.getId();
Content cont = getContent(artifact.getId(), def.getId());
addContentToInternalMap(copy.getId(), def.getId(), cont.asByteArray());
Content cont = getContent(artifact.getOriginalNodeId(), def.getId());
addContentToInternalMap(copy.getOriginalNodeId(), def.getId(), cont.asByteArray());
}
}
......@@ -106,7 +106,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
*/
public static RepositoryFolderImpl clone(RepositoryFolder folder) {
// TODO: Maybe make deep copy?
RepositoryFolderImpl newFolder = new RepositoryFolderImpl(folder.getId());
RepositoryFolderImpl newFolder = new RepositoryFolderImpl(folder.getConnectorId(), folder.getOriginalNodeId());
newFolder.getMetadata().setName(folder.getMetadata().getName());
newFolder.getMetadata().setParentFolderId(folder.getMetadata().setParentFolderId());
......@@ -118,7 +118,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
* later
*/
public RepositoryArtifactImpl clone(RepositoryArtifact artifact) {
RepositoryArtifactImpl newArtifact = new RepositoryArtifactImpl(artifact.getId(), artifact.getArtifactType(), this);
RepositoryArtifactImpl newArtifact = new RepositoryArtifactImpl(artifact.getConnectorId(), artifact.getOriginalNodeId(), artifact.getArtifactType(), this);
newArtifact.getMetadata().setName(artifact.getMetadata().getName());
newArtifact.getMetadata().setParentFolderId(artifact.getMetadata().setParentFolderId());
......@@ -181,9 +181,9 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
}
} else {
for (RepositoryNode node : nodes) {
if (node.getId().startsWith(parentUrl) && !node.getId().equals(parentUrl)) {
if (node.getOriginalNodeId().startsWith(parentUrl) && !node.getOriginalNodeId().equals(parentUrl)) {
// remove / at the end
String remainingUrl = node.getId().substring(parentUrl.length() + 1);
String remainingUrl = node.getOriginalNodeId().substring(parentUrl.length() + 1);
remainingUrl = remainingUrl.substring(0, remainingUrl.length() - 1);
if (!remainingUrl.contains("/")) {
......@@ -201,7 +201,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
public RepositoryArtifact getRepositoryArtifact(String id) {
for (RepositoryNode node : nodes) {
if (node.getId().equals(id) && node instanceof RepositoryArtifact) {
if (node.getOriginalNodeId().equals(id) && node instanceof RepositoryArtifact) {
return clone((RepositoryArtifact) node);
}
}
......@@ -210,7 +210,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
public RepositoryFolder getRepositoryFolder(String id) {
for (RepositoryNode node : nodes) {
if (node.getId().equals(id) && node instanceof RepositoryFolder) {
if (node.getOriginalNodeId().equals(id) && node instanceof RepositoryFolder) {
return clone((RepositoryFolder) node);
}
}
......@@ -245,7 +245,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
}
id = id + artifactName;
RepositoryArtifact newArtifact = new RepositoryArtifactImpl(id, getArtifactType(artifactType), this);
RepositoryArtifact newArtifact = new RepositoryArtifactImpl(getConfiguration().getId(), id, getArtifactType(artifactType), this);
newArtifact.getMetadata().setName(artifactName);
newArtifact.getMetadata().setParentFolderId(containingFolderId);
nodes.add(newArtifact);
......@@ -272,7 +272,7 @@ public class DemoConnector extends AbstractRepositoryConnector<DemoConnectorConf
id = id + "/";
}
id = id + name;
RepositoryFolderImpl newFolder = new RepositoryFolderImpl(id);
RepositoryFolderImpl newFolder = new RepositoryFolderImpl(getConfiguration().getId(), id);
newFolder.getMetadata().setName(name);
newFolder.getMetadata().setParentFolderId(parentFolderId);
......
......@@ -7,6 +7,7 @@ public class DemoConnectorConfiguration extends RepositoryConnectorConfiguration
public DemoConnectorConfiguration(String name) {
setName(name);
setId(name);
}
@Override
......
......@@ -58,7 +58,7 @@ public class CopyArtifactAction extends ParameterizedHtmlFormTemplateAction {
// targetName;
// }
Content content = sourceConnector.getContent(artifact.getId(), artifact.getArtifactType().getDefaultContentRepresentation().getId());
Content content = sourceConnector.getContent(artifact.getOriginalNodeId(), artifact.getArtifactType().getDefaultContentRepresentation().getId());
targetConnector.createArtifact(targetFolder, targetName, artifact.getArtifactType().getId(), content);
}
}
......@@ -25,12 +25,12 @@ public class DemoProvider extends ContentProviderImpl {
@Override
public void addValueToContent(Content content, RepositoryConnector connector, RepositoryArtifact artifact) {
Map<String, byte[]> map = DemoConnector.content.get(artifact.getId());
Map<String, byte[]> map = DemoConnector.content.get(artifact.getOriginalNodeId());
if (map != null) {
content.setValue(map.get(contentRepresentationName));
return;
}
throw new RepositoryException("Couldn't find content representation '" + contentRepresentationName + "' for artifact " + artifact.getId());
throw new RepositoryException("Couldn't find content representation '" + contentRepresentationName + "' for artifact " + artifact.getOriginalNodeId());
}
}
......@@ -160,7 +160,7 @@ public class FileSystemConnector extends AbstractRepositoryConnector<FileSystemC
// TODO: We should have an extension to ArtifactType mapping somewhere
ArtifactType artifactType = getConfiguration().getArtifactType(mimeType);
RepositoryArtifactImpl artifact = new RepositoryArtifactImpl(id, artifactType, this);
RepositoryArtifactImpl artifact = new RepositoryArtifactImpl(getConfiguration().getId(), id, artifactType, this);
artifact.getMetadata().setName(file.getName());
// TODO: CHECK Implementation
......@@ -202,7 +202,7 @@ public class FileSystemConnector extends AbstractRepositoryConnector<FileSystemC
// root folder is again a special case
id = "/";
}
RepositoryFolderImpl folder = new RepositoryFolderImpl(id);
RepositoryFolderImpl folder = new RepositoryFolderImpl(getConfiguration().getId(), id);
folder.getMetadata().setName(file.getName());
// TODO: Implement
// folder.getMetadata().setParentFolderId();
......
......@@ -17,7 +17,7 @@ import org.activiti.cycle.impl.util.IoUtils;
public class FileBinaryContentProvider extends ContentProviderImpl {
@Override
public void addValueToContent(Content content, RepositoryConnector connector, RepositoryArtifact artifact) {
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getId();
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getOriginalNodeId();
File file = new File(fileName);
FileInputStream fis = null;
......
......@@ -15,7 +15,7 @@ public class TextFileContentProvider extends ContentProviderImpl {
@Override
public void addValueToContent(Content content, RepositoryConnector connector, RepositoryArtifact artifact) {
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getId();
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getOriginalNodeId();
File file = new File(fileName);
try{
content.setValue(new FileInputStream(file));
......
......@@ -18,7 +18,7 @@ public class XmlFileContentProvider extends ContentProviderImpl {
@Override
public void addValueToContent(Content content, RepositoryConnector connector, RepositoryArtifact artifact) {
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getId();
String fileName = ((FileSystemConnector) connector).getConfiguration().getBasePath() + artifact.getOriginalNodeId();
File file = new File(fileName);
try {
......
......@@ -204,7 +204,7 @@ public class SignavioConnector extends AbstractRepositoryConnector<SignavioConne
// folderInfo.setId( directoryId );
// TODO: Check where we get the real ID from!
String id = getConfiguration().getDirectoryIdFromUrl(href);
RepositoryFolderImpl folderInfo = new RepositoryFolderImpl(id);
RepositoryFolderImpl folderInfo = new RepositoryFolderImpl(getConfiguration().getId(), id);
folderInfo.getMetadata().setName(directoryName);
// TODO: Where do we get the path from?
......@@ -220,7 +220,7 @@ public class SignavioConnector extends AbstractRepositoryConnector<SignavioConne
private RepositoryArtifact getArtifactInfoFromFile(String id, JSONObject json) throws JSONException {
ArtifactType artifactType = getArtifactTypeForSignavioArtifact(json);
RepositoryArtifactImpl fileInfo = new RepositoryArtifactImpl(id, artifactType, this);
RepositoryArtifactImpl fileInfo = new RepositoryArtifactImpl(getConfiguration().getId(), id, artifactType, this);
if (json.has("name")) {
fileInfo.getMetadata().setName(json.optString("name"));
......@@ -336,10 +336,7 @@ public class SignavioConnector extends AbstractRepositoryConnector<SignavioConne
try {
Response modelResponse = getJsonResponse(getConfiguration().getModelUrl(id) + "/info");
jsonData = new JsonRepresentation(modelResponse.getEntity());
if (log.isLoggable(Level.FINE)) {
log.fine("JsonData - (" + jsonData.getText() + ")");
}
jsonObject = jsonData.getJsonObject();
jsonObject = jsonData.getJsonObject();
return getArtifactInfoFromFile(id, jsonObject);
} catch (Exception ex) {
throw new RepositoryNodeNotFoundException(getConfiguration().getName(), RepositoryArtifact.class, id, ex);
......@@ -404,7 +401,7 @@ public class SignavioConnector extends AbstractRepositoryConnector<SignavioConne
}
public String getModelUrl(RepositoryArtifact artifact) {
return getConfiguration().getModelUrl(artifact.getId());
return getConfiguration().getModelUrl(artifact.getOriginalNodeId());
}
public void commitPendingChanges(String comment) {
......
......@@ -86,7 +86,7 @@ public class CreateTechnicalBpmnXmlAction extends ParameterizedHtmlFormTemplateA
}
protected String getBpmn20Json(RepositoryConnector connector, RepositoryArtifact artifact) {
return connector.getContent(artifact.getId(), SignavioPluginDefinition.CONTENT_REPRESENTATION_ID_JSON).asString();
return connector.getContent(artifact.getOriginalNodeId(), SignavioPluginDefinition.CONTENT_REPRESENTATION_ID_JSON).asString();
}
protected String applyJsonTransformations(String sourceJson) {
......
......@@ -37,7 +37,7 @@ public class OpenModelerAction extends CreateUrlActionImpl {
public URL getUrl(RepositoryConnector connector, RepositoryArtifact artifact) {
try {
return new URL(((SignavioConnector) connector).getConfiguration().getEditorUrl(artifact.getId()));
return new URL(((SignavioConnector) connector).getConfiguration().getEditorUrl(artifact.getOriginalNodeId()));
} catch (MalformedURLException ex) {
throw new RepositoryException("Error while creating URL for opening Signavio modeler", ex);
}
......
......@@ -39,7 +39,7 @@ public class ValidateActivitiDeployment extends CreateTechnicalBpmnXmlAction {
BpmnParser bpmnParser = new BpmnParser(expressionManager);
// parse to validate
bpmnParser.createParse().sourceString(bpmnXml).name(artifact.getId()).execute();
bpmnParser.createParse().sourceString(bpmnXml).name(artifact.getOriginalNodeId()).execute();
// That's it, now we get an exception is the file is invalid
}
......
......@@ -60,7 +60,7 @@ public class EmbeddableModelProvider extends SignavioContentRepresentationProvid
embeddedModelForm.add("label", "");
embeddedModelForm.add("mails", "");
embeddedModelForm.add("message", "");
embeddedModelForm.add("sbo", artifact.getId());
embeddedModelForm.add("sbo", artifact.getOriginalNodeId());
embeddedModelForm.add("type", "png");
Representation embeddedModelRep = embeddedModelForm.getWebRepresentation();
......@@ -171,7 +171,7 @@ public class EmbeddableModelProvider extends SignavioContentRepresentationProvid
// Creating the JSON Object for the Snippet
JSONObject resultJsonObject = new JSONObject();
resultJsonObject.put("url", connector.getConfiguration().getModelUrl(artifact.getId()));
resultJsonObject.put("url", connector.getConfiguration().getModelUrl(artifact.getOriginalNodeId()));
resultJsonObject.put("overflowX", "fit");
resultJsonObject.put("overflowY", "fit");
resultJsonObject.put("zoomSlider", true);
......@@ -237,7 +237,7 @@ public class EmbeddableModelProvider extends SignavioContentRepresentationProvid
try {
Client client = connector.initClient();
Reference embeddedModelRef = new Reference(connector.getConfiguration().getSignavioUrl() + "purl/" + artifact.getId() + "/info/");
Reference embeddedModelRef = new Reference(connector.getConfiguration().getSignavioUrl() + "purl/" + artifact.getOriginalNodeId() + "/info/");
Request embeddedModelRequest = new Request(Method.DELETE, embeddedModelRef);
......
......@@ -25,7 +25,7 @@ public class PngProvider extends SignavioContentRepresentationProvider {
@Override
public void addValueToContent(Content content, SignavioConnector connector, RepositoryArtifact artifact) {
try {
String modelAsPngUrl = connector.getConfiguration().getPngUrl(artifact.getId(), connector.getSecurityToken());
String modelAsPngUrl = connector.getConfiguration().getPngUrl(artifact.getOriginalNodeId(), connector.getSecurityToken());
InputStream is = new URL(modelAsPngUrl).openStream();
content.setValue(is);
} catch (Exception ex) {
......
......@@ -28,6 +28,8 @@ import org.activiti.cycle.impl.RepositoryNodeImpl;
*/
public class RootConnector implements RepositoryConnector {
public static final String ROOT_CONNECTOR_ID = "ROOT-CONNECTOR";
private List<RepositoryConnector> repositoryConnectors;
private RootConnectorConfiguration configuration;
......@@ -52,13 +54,13 @@ public class RootConnector implements RepositoryConnector {
}
private RepositoryConnector getRepositoryConnector(String name) {
private RepositoryConnector getRepositoryConnector(String connectorId) {
for (RepositoryConnector connector : getRepositoryConnectors()) {
if (connector.getConfiguration().getName().equals(name)) {
if (connector.getConfiguration().getId().equals(connectorId)) {
return connector;
}
}
throw new RepositoryException("Couldn't find Repository Connector with name '" + name + "'");
throw new RepositoryException("Couldn't find Repository Connector with id '" + connectorId + "'");
}
/**
......@@ -87,52 +89,30 @@ public class RootConnector implements RepositoryConnector {
}
}
/**
* construct a unique id for an {@link RepositoryNode} by adding the connector
* name (since this connector maintains different repos)
*/
private String getIdWithRepoName(RepositoryConnector connector, RepositoryNode repositoryNode) {
String repositoryName = connector.getConfiguration().getName();
if (!repositoryNode.getId().startsWith("/")) {
throw new RepositoryException("RepositoryNode id doesn't start with a slash, which is considered invalid: '" + repositoryNode.getId()
+ "' in repository '" + repositoryName + "'");
} else {
return getRepositoryPrefix(repositoryName) + repositoryNode.getId();
}
}
/**
* return the prefix for the {@link RepositoryConnector}
*/
private String getRepositoryPrefix(String repositoryName) {
return "/" + repositoryName;
}
/**
* add repository name in config to URL
*/
private RepositoryNode adjust(RepositoryConnector connector, RepositoryNode node) {
private void adjust(RepositoryConnector connector, RepositoryNode node) {
RepositoryNodeImpl repositoryNode = ((RepositoryNodeImpl) node);
repositoryNode.setId(getIdWithRepoName(connector, repositoryNode));
return repositoryNode;
repositoryNode.addNewRootToCurrentPath(connector.getConfiguration().getId());
}
protected RepositoryConnector getConnectorFromUrl(String url) {
protected RepositoryConnector getConnectorFromUrl(String parentCurrentPath) {
RepositoryConnector connector = null;
int index = url.indexOf("/");
int index = parentCurrentPath.indexOf("/");
if (index == -1) {
// demo connector itself
connector = getRepositoryConnector(url);
connector = getRepositoryConnector(parentCurrentPath);
} else if (index == 0) {
connector = getConnectorFromUrl(url.substring(1));
connector = getConnectorFromUrl(parentCurrentPath.substring(1));
} else {
String repositoryName = url.substring(0, index);
String repositoryName = parentCurrentPath.substring(0, index);
connector = getRepositoryConnector(repositoryName);
}
if (connector == null) {
throw new RepositoryException("Couldn't find any RepositoryConnector for url '" + url + "'");
throw new RepositoryException("Couldn't find any RepositoryConnector for url '" + parentCurrentPath + "'");
} else {
return connector;
}
......@@ -150,19 +130,19 @@ public class RootConnector implements RepositoryConnector {
}
}
public RepositoryNodeCollection getChildren(String parentUrl) {
public RepositoryNodeCollection getChildren(String parentCurrentPath) {
// special handling for root
if ("/".equals(parentUrl)) {
if ("/".equals(parentCurrentPath)) {
return getRepoRootFolders();
}
// First identify correct repo and truncate path to local part of
// connector
RepositoryConnector connector = getConnectorFromUrl(parentUrl);
parentUrl = getRepositoryPartOfUrl(parentUrl);
RepositoryConnector connector = getConnectorFromUrl(parentCurrentPath);
parentCurrentPath = getRepositoryPartOfUrl(parentCurrentPath);
// now make the query
RepositoryNodeCollection children = connector.getChildren(parentUrl);
RepositoryNodeCollection children = connector.getChildren(parentCurrentPath);
// and adjust the result to include repo name
for (RepositoryNode repositoryNode : children.asList()) {
......@@ -174,11 +154,12 @@ public class RootConnector implements RepositoryConnector {
public RepositoryNodeCollection getRepoRootFolders() {
ArrayList<RepositoryNode> nodes = new ArrayList<RepositoryNode>();
for (RepositoryConnector connector : getRepositoryConnectors()) {
String repoName = connector.getConfiguration().getName();
RepositoryFolderImpl folder = new RepositoryFolderImpl(repoName);
folder.getMetadata().setName(repoName);
RepositoryFolderImpl folder = new RepositoryFolderImpl(ROOT_CONNECTOR_ID, connector.getConfiguration().getId());
folder.getMetadata().setName(connector.getConfiguration().getName());
folder.getMetadata().setParentFolderId("/");
nodes.add(folder);
}
return new RepositoryNodeCollectionImpl(nodes);
}
......
......@@ -45,7 +45,7 @@ public class RepositoryLogHelper {
public static void logFolder(RepositoryConnector connector, String intend, RepositoryNodeCollection folder) {
log.log(Level.INFO, intend + folder);
for (RepositoryFolder subFolder : folder.getFolderList()) {
printFolder(connector, intend + " ", connector.getChildren(subFolder.getId()));
printFolder(connector, intend + " ", connector.getChildren(subFolder.getOriginalNodeId()));
}
for (RepositoryArtifact file : folder.getArtifactList()) {
log.log(Level.INFO, intend + "-" + file);
......@@ -60,7 +60,7 @@ public class RepositoryLogHelper {
public static void printNodes(RepositoryConnector connector, String intend, List<RepositoryNode> nodes) {
for (RepositoryNode node : nodes) {
if (node instanceof RepositoryFolder) {
printFolder(connector, intend + " ", connector.getChildren(node.getId()));
printFolder(connector, intend + " ", connector.getChildren(node.getOriginalNodeId()));
} else {
printArtifact(intend, (RepositoryArtifact) node);
}
......
......@@ -43,7 +43,7 @@ public class DemoConnectorTest {
List<RepositoryNode> childNodes = conn.getChildren("/").asList();
assertEquals(1, childNodes.size());
assertEquals("demo", childNodes.get(0).getId());
assertEquals("demo", childNodes.get(0).getCurrentPath());
childNodes = conn.getChildren("demo").asList();
......@@ -51,37 +51,37 @@ public class DemoConnectorTest {
assertTrue(childNodes.get(0) instanceof RepositoryFolder);
RepositoryFolder folder1 = (RepositoryFolder) childNodes.get(0);
assertEquals("/demo/minutes", folder1.getId());
assertEquals("/demo/minutes", folder1.getCurrentPath());
// assertEquals("http://localhost:8080/activiti-cycle/demo/minutes",
// folder1.getClientUrl());
assertTrue(childNodes.get(1) instanceof RepositoryFolder);
RepositoryFolder folder2 = (RepositoryFolder) childNodes.get(1);
assertEquals("/demo/BPMN", folder2.getId());
assertEquals("/demo/BPMN", folder2.getCurrentPath());
// check sub elements of folder 1
childNodes = conn.getChildren(folder1.getId()).asList();
childNodes = conn.getChildren(folder1.getCurrentPath()).asList();
assertEquals(2, childNodes.size());
RepositoryArtifact file1 = (RepositoryArtifact) childNodes.get(0);
assertEquals("/demo/minutes/20100701-KickOffMeeting.txt", file1.getId());
assertEquals("/demo/minutes/20100701-KickOffMeeting.txt", file1.getCurrentPath());
RepositoryArtifact file2 = (RepositoryArtifact) childNodes.get(1);
assertEquals("/demo/minutes/InitialMindmap.mm", file2.getId());
assertEquals("/demo/minutes/InitialMindmap.mm", file2.getCurrentPath());
// check sub elements of folder 2
childNodes = conn.getChildren(folder2.getId()).asList();
childNodes = conn.getChildren(folder2.getCurrentPath()).asList();
assertEquals(1, childNodes.size());
RepositoryFolder folder3 = (RepositoryFolder) childNodes.get(0);
assertEquals("/demo/BPMN/Level3", folder3.getId());
assertEquals("/demo/BPMN/Level3", folder3.getCurrentPath());
childNodes = conn.getChildren(folder3.getId()).asList();
childNodes = conn.getChildren(folder3.getCurrentPath()).asList();
assertEquals(1, childNodes.size());
RepositoryArtifact file3 = (RepositoryArtifact) childNodes.get(0);
assertEquals("/demo/BPMN/Level3/InitialBpmnModel", file3.getId());
assertEquals("/demo/BPMN/Level3/InitialBpmnModel", file3.getCurrentPath());
assertEquals("InitialBpmnModel", file3.getMetadata().getName());
assertEquals("/BPMN/Level3", file3.getMetadata().setParentFolderId());
//
......@@ -91,7 +91,7 @@ public class DemoConnectorTest {
//
Collection<ContentRepresentation> contentRepresentations = file3.getArtifactType().getContentRepresentations();
for (ContentRepresentation contentRepresentation : contentRepresentations) {
Content content = conn.getContent(file3.getId(), contentRepresentation.getId());
Content content = conn.getContent(file3.getCurrentPath(), contentRepresentation.getId());
assertNotNull(content);
assertNotNull(content.asByteArray());
}
......@@ -104,19 +104,19 @@ public class DemoConnectorTest {
parameters.put("targetFolderConnector", conn);
parameters.put("targetFolder", "/demo/minutes");
conn.executeParameterizedAction(file1.getId(), CopyArtifactAction.class.getName(), parameters);
conn.executeParameterizedAction(file1.getCurrentPath(), CopyArtifactAction.class.getName(), parameters);
List<RepositoryNode> nodes = DemoConnector.nodes;
assertEquals(8, DemoConnector.nodes.size());
childNodes = conn.getChildren(folder1.getId()).asList();
childNodes = conn.getChildren(folder1.getCurrentPath()).asList();
assertEquals(4, childNodes.size());
assertEquals("/demo/minutes/20100701-KickOffMeeting.txt", childNodes.get(0).getId());
assertEquals("/demo/minutes/InitialMindmap.mm", childNodes.get(1).getId());
assertEquals("/demo/minutes/xxx.txt0", childNodes.get(2).getId());
assertEquals("/demo/minutes/20100701-KickOffMeeting.txt", childNodes.get(0).getCurrentPath());
assertEquals("/demo/minutes/InitialMindmap.mm", childNodes.get(1).getCurrentPath());
assertEquals("/demo/minutes/xxx.txt0", childNodes.get(2).getCurrentPath());
assertEquals("xxx.txt0", childNodes.get(2).getMetadata().getName());
assertEquals("/demo/minutes/xxx.txt1", childNodes.get(3).getId());
assertEquals("/demo/minutes/xxx.txt1", childNodes.get(3).getCurrentPath());
assertEquals("xxx.txt1", childNodes.get(3).getMetadata().getName());
}
......
......@@ -51,7 +51,7 @@ public class FileSystemConnectorTest {
Collection<ContentRepresentation> contentRepresentations = artifact.getArtifactType().getContentRepresentations();
for (ContentRepresentation contentRepresentation : contentRepresentations) {
System.out.println(contentRepresentation.getId() + " -> " + conn.getContent(artifact.getId(), contentRepresentation.getId()).asString());
System.out.println(contentRepresentation.getId() + " -> " + conn.getContent(artifact.getOriginalNodeId(), contentRepresentation.getId()).asString());
}
}
}
......
......@@ -86,7 +86,7 @@ public class ArtifactGet extends ActivitiWebScript {
}
model.put("downloads", downloads);
model.put("links", artifact.getOutgoingLinks());
model.put("artifactId", artifact.getId());
model.put("links", artifact.getOpenLinkActions());
model.put("artifactId", artifact.getCurrentPath());
}
}
......@@ -18,9 +18,9 @@ import java.util.Date;
import javax.servlet.http.HttpSession;
import org.activiti.cycle.ContentRepresentation;
import org.activiti.cycle.CycleDefaultMimeType;
import org.activiti.cycle.RepositoryArtifact;
import org.activiti.cycle.RepositoryConnector;
import org.activiti.cycle.CycleDefaultMimeType;
import org.activiti.cycle.impl.db.CycleServiceDbXStreamImpl;
import org.activiti.rest.util.ActivitiRequest;
import org.activiti.rest.util.ActivitiStreamingWebScript;
......@@ -83,7 +83,7 @@ public class ContentGet extends ActivitiStreamingWebScript {
}
// TODO: what is a good way to determine the etag? Using a fake one...
streamResponse(res, repositoryConnector.getContent(artifact.getId(), contentRepresentation.getId()).asInputStream(), new Date(0),
streamResponse(res, repositoryConnector.getContent(artifact.getCurrentPath(), contentRepresentation.getId()).asInputStream(), new Date(0),
"W/\"647-1281077702000\"", attach, attachmentFileName, contentType);
}
......
......@@ -7,7 +7,7 @@
<#macro printFolder folder>
{
"label": "${folder.metadata.name}",
"id": "${folder.id}",
"id": "${folder.currentPath}",
"folder": "true"
}
</#macro>
......@@ -15,7 +15,7 @@
<#macro printFile file>
{
"label": "${file.metadata.name}",
"id": "${file.id}",
"id": "${file.currentPath}",
"expanded": "true",
"file": "true",
"contentType": "${file.artifactType.mimeType.contentType}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册