Skip to content

Commit

Permalink
Merge pull request #217 from aegif/integration
Browse files Browse the repository at this point in the history
ver2.3.13
  • Loading branch information
linzhixing committed Jun 2, 2016
2 parents 51527c4 + 3204a17 commit f812f74
Show file tree
Hide file tree
Showing 51 changed files with 2,343 additions and 1,023 deletions.
29 changes: 19 additions & 10 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>jp.aegif.nemaki</groupId>
<artifactId>core</artifactId>
<packaging>war</packaging>
<version>2.3.12</version>
<version>2.3.13</version>
<name>core</name>
<description>NemakiWare server</description>
<url>https://github.com/NemakiWare/NemakiWare</url>
Expand Down Expand Up @@ -34,11 +34,8 @@
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<type>jar</type>
<scope>test</scope>
<optional>false</optional>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -246,7 +243,7 @@
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.7.2</version>
<version>2.10.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -274,6 +271,18 @@
<artifactId>cloning</artifactId>
<version>1.9.1</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.3</version>
</dependency>

<dependency>
<groupId>jp.aegif.nemakiware</groupId>
Expand Down Expand Up @@ -301,9 +310,9 @@
<version>2.19.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<includes>
<include>**/*TestGroup.java</include>
</includes>
<includes>
<include>**/*TestGroup.java</include>
</includes>
</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Item createItem(CallContext callContext, String repositoryId,
* @return
*/
Content update(String repositoryId, Content content);

/**
* Update properties of a content
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,18 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import jp.aegif.nemaki.businesslogic.ContentService;
import jp.aegif.nemaki.businesslogic.rendition.RenditionManager;
import jp.aegif.nemaki.cmis.aspect.query.solr.SolrUtil;
import jp.aegif.nemaki.cmis.aspect.type.TypeManager;
import jp.aegif.nemaki.cmis.factory.info.RepositoryInfo;
import jp.aegif.nemaki.cmis.factory.info.RepositoryInfoMap;
import jp.aegif.nemaki.dao.ContentDaoService;
import jp.aegif.nemaki.dao.impl.cached.ContentDaoServiceImpl;
import jp.aegif.nemaki.model.Ace;
import jp.aegif.nemaki.model.Acl;
import jp.aegif.nemaki.model.Archive;
Expand Down Expand Up @@ -212,10 +207,11 @@ public Folder getParent(String repositoryId, String objectId) {
public List<Content> getChildren(String repositoryId, String folderId) {
List<Content> children = new ArrayList<Content>();

List<Content> indices = contentDaoService.getLatestChildrenIndex(repositoryId, folderId);
List<Content> indices = contentDaoService.getChildren(repositoryId, folderId);
if (CollectionUtils.isEmpty(indices))
return null;


//TODO getを重複して行う必要なし
for (Content c : indices) {
if (c.isDocument()) {
Document d = contentDaoService.getDocument(repositoryId, c.getId());
Expand Down Expand Up @@ -613,21 +609,29 @@ public Document checkOut(CallContext callContext, String repositoryId, String ob
public void cancelCheckOut(CallContext callContext, String repositoryId, String objectId,
ExtensionsData extension) {
Document pwc = getDocument(repositoryId, objectId);
VersionSeries vs = getVersionSeries(repositoryId, pwc);


writeChangeEvent(callContext, repositoryId, pwc, ChangeType.DELETED);

// Delete attachment & document itself(without archiving)
contentDaoService.delete(repositoryId, pwc.getAttachmentNodeId());
contentDaoService.delete(repositoryId, pwc.getId());

VersionSeries vs = getVersionSeries(repositoryId, pwc);
// Reverse the effect of checkout
setModifiedSignature(callContext, vs);
vs.setVersionSeriesCheckedOut(false);
vs.setVersionSeriesCheckedOutBy("");
vs.setVersionSeriesCheckedOutId("");
contentDaoService.update(repositoryId, vs);

List<Document> versions = getAllVersions(callContext, repositoryId, vs.getId());
if(CollectionUtils.isNotEmpty(versions)){
//Collections.sort(versions, new VersionComparator());
for(Document version : versions){
contentDaoService.refreshCmisObjectData(repositoryId, version.getId());
}
}

// Call Solr indexing(optional)
solrUtil.callSolrIndexing(repositoryId);
}
Expand All @@ -637,10 +641,11 @@ public Document checkIn(CallContext callContext, String repositoryId, Holder<Str
Properties properties, ContentStream contentStream, String checkinComment, List<String> policies,
org.apache.chemistry.opencmis.commons.data.Acl addAces,
org.apache.chemistry.opencmis.commons.data.Acl removeAces, ExtensionsData extension) {

String id = objectId.getValue();

Document pwc = getDocument(repositoryId, id);
Document checkedIn = buildCopyDocumentWithBasicProperties(callContext, pwc);

Document latest = getDocumentOfLatestVersion(repositoryId, pwc.getVersionSeriesId());

// When PWCUpdatable is true
Expand All @@ -657,6 +662,9 @@ public Document checkIn(CallContext callContext, String repositoryId, Holder<Str
setSignature(callContext, checkedIn);
checkedIn.setCheckinComment(checkinComment);

// Reverse the effect of checkedout
cancelCheckOut(callContext, repositoryId, id, extension);

// update version information
VersioningState versioningState = (major) ? VersioningState.MAJOR : VersioningState.MINOR;
updateVersionProperties(callContext, repositoryId, versioningState, checkedIn, latest);
Expand All @@ -669,9 +677,6 @@ public Document checkIn(CallContext callContext, String repositoryId, Holder<Str
// Record the change event
writeChangeEvent(callContext, repositoryId, result, ChangeType.CREATED);

// Reverse the effect of checkedout
cancelCheckOut(callContext, repositoryId, id, extension);

// Call Solr indexing(optional)
solrUtil.callSolrIndexing(repositoryId);

Expand Down Expand Up @@ -1118,7 +1123,7 @@ private List<Property> injectPropertyValue(Collection<PropertyDefinition<?>> pro
}

@Override
public synchronized Content updateProperties(CallContext callContext, String repositoryId, Properties properties,
public Content updateProperties(CallContext callContext, String repositoryId, Properties properties,
Content content) {

Content modified = modifyProperties(callContext, repositoryId, properties, content);
Expand All @@ -1130,9 +1135,9 @@ public synchronized Content updateProperties(CallContext callContext, String rep

return result;
}

@Override
public synchronized Content update(String repositoryId, Content content) {
public Content update(String repositoryId, Content content) {
Content result = null;

if (content instanceof Document) {
Expand Down Expand Up @@ -1174,18 +1179,31 @@ private void setUpdatePropertyValue(String repositoryId, Content content, Proper
}

@Override
public synchronized void move(String repositoryId, Content content, Folder target) {
public void move(String repositoryId, Content content, Folder target) {
String sourceId = content.getParentId();

content.setParentId(target.getId());
String uniqueName = buildUniqueName(repositoryId, content.getName(), target.getId(), null);
content.setName(uniqueName);
update(repositoryId, content);

move(repositoryId, content, sourceId);

// Call Solr indexing(optional)
solrUtil.callSolrIndexing(repositoryId);
}

private Content move(String repositoryId, Content content, String sourceId){
Content result = null;
if(content instanceof Document){
result = contentDaoService.move(repositoryId, (Document)content, sourceId);
}else if(content instanceof Folder){
result = contentDaoService.move(repositoryId, (Folder)content, sourceId);
}
return result;
}

@Override
public synchronized void applyPolicy(CallContext callContext, String repositoryId, String policyId, String objectId,
public void applyPolicy(CallContext callContext, String repositoryId, String policyId, String objectId,
ExtensionsData extension) {
Policy policy = getPolicy(repositoryId, policyId);
List<String> ids = policy.getAppliedIds();
Expand All @@ -1199,7 +1217,7 @@ public synchronized void applyPolicy(CallContext callContext, String repositoryI
}

@Override
public synchronized void removePolicy(CallContext callContext, String repositoryId, String policyId,
public void removePolicy(CallContext callContext, String repositoryId, String policyId,
String objectId, ExtensionsData extension) {
Policy policy = getPolicy(repositoryId, policyId);
List<String> ids = policy.getAppliedIds();
Expand All @@ -1218,6 +1236,12 @@ public synchronized void removePolicy(CallContext callContext, String repository
@Override
public void delete(CallContext callContext, String repositoryId, String objectId, Boolean deletedWithParent) {
Content content = getContent(repositoryId, objectId);

//TODO workaround
if(content == null){
//If content is already deleted, do nothing;
return;
}

// Record the change event(Before the content is deleted!)
writeChangeEvent(callContext, repositoryId, content, ChangeType.DELETED);
Expand Down Expand Up @@ -1390,7 +1414,7 @@ private boolean isPreviewEnabled() {
}

@Override
public synchronized void appendAttachment(CallContext callContext, String repositoryId, Holder<String> objectId,
public void appendAttachment(CallContext callContext, String repositoryId, Holder<String> objectId,
Holder<String> changeToken, ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
Document document = contentDaoService.getDocument(repositoryId, objectId.getValue());
AttachmentNode attachment = getAttachment(repositoryId, document.getAttachmentNodeId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public ObjectData compileObjectData(CallContext context,
String repositoryId, Content content, String filter,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeAcl);

public <T> ObjectList compileObjectDataList(CallContext callContext,
public <T extends Content> ObjectList compileObjectDataList(CallContext callContext,
String repositoryId, List<T> contents, String filter,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeAcl, BigInteger maxItems, BigInteger skipCount, boolean folderOnly);
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includeAcl, BigInteger maxItems, BigInteger skipCount, boolean folderOnly, String orderBy);

public ObjectList compileChangeDataList(CallContext context, String repositoryId,
List<Change> changes, Holder<String> changeLogToken, Boolean includeProperties,
Expand Down
Loading

0 comments on commit f812f74

Please sign in to comment.