├── .classpath
├── .gitignore
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
└── org.eclipse.m2e.core.prefs
├── .springBeans
├── README.md
├── atlassian-ide-plugin.xml
├── documentum
├── cache
│ └── 7.1.1000.0037SP1
│ │ └── bof
│ │ └── FPIRepo
│ │ ├── content.lck
│ │ └── content.xml
└── identityInterprocessMutex.lock
├── pom.xml
├── spring-data-documentum.iml
├── spring-data-documentum.ipr
├── spring-data-documentum.iws
├── src
├── main
│ └── java
│ │ └── com
│ │ └── emc
│ │ └── documentum
│ │ └── springdata
│ │ ├── core
│ │ ├── Application.java
│ │ ├── DctmAutoConfiguration.java
│ │ ├── DctmOperations.java
│ │ ├── DctmTemplate.java
│ │ ├── Documentum.java
│ │ ├── GenericCache.java
│ │ └── exception
│ │ │ └── DSException.java
│ │ ├── entitymanager
│ │ ├── EntityPersistenceManager.java
│ │ ├── EntityTypeHandler.java
│ │ ├── annotations
│ │ │ ├── Content.java
│ │ │ ├── Relation.java
│ │ │ └── RelationshipType.java
│ │ ├── attributes
│ │ │ ├── Attribute.java
│ │ │ ├── AttributeFactory.java
│ │ │ ├── AttributeType.java
│ │ │ ├── BooleanAttribute.java
│ │ │ ├── BooleanListAttribute.java
│ │ │ ├── DoubleAttribute.java
│ │ │ ├── DoubleListAttribute.java
│ │ │ ├── EntityAttribute.java
│ │ │ ├── EntityCollectionAttribute.java
│ │ │ ├── IntAttribute.java
│ │ │ ├── IntListAttribute.java
│ │ │ ├── IterableAttribute.java
│ │ │ ├── LongAttribute.java
│ │ │ ├── LongListAttribute.java
│ │ │ ├── ObjectAttribute.java
│ │ │ ├── StringAttribute.java
│ │ │ ├── StringListAttribute.java
│ │ │ └── TypeUtils.java
│ │ ├── convert
│ │ │ ├── DCTMToObjectConverter.java
│ │ │ └── ObjectToDCTMConverter.java
│ │ └── mapping
│ │ │ ├── BasicDctmPersistentEntity.java
│ │ │ ├── BasicDctmPersistentProperty.java
│ │ │ ├── DctmAttribute.java
│ │ │ ├── DctmEntity.java
│ │ │ ├── DctmMappingContext.java
│ │ │ ├── DctmPersistentProperty.java
│ │ │ ├── MappingHandler.java
│ │ │ └── package-info.java
│ │ ├── log
│ │ ├── AutowiredLogger.java
│ │ └── LoggerInjector.java
│ │ ├── repository
│ │ ├── DctmRepository.java
│ │ ├── DctmRepositoryWithContent.java
│ │ ├── Query.java
│ │ ├── config
│ │ │ ├── AbstractDctmConfiguration.java
│ │ │ ├── DctmAttribute.java
│ │ │ ├── DctmRepositoriesRegistrar.java
│ │ │ ├── DctmRepositoryConfigExtension.java
│ │ │ └── EnableDctmRepositories.java
│ │ ├── query
│ │ │ ├── AbstractDctmQuery.java
│ │ │ ├── DctmEntityMetadata.java
│ │ │ ├── DctmQuery.java
│ │ │ ├── DctmQueryCreator.java
│ │ │ ├── DctmQueryMethod.java
│ │ │ ├── PartTreeDctmQuery.java
│ │ │ ├── SimpleDctmEntityMetadata.java
│ │ │ ├── StringBasedDctmQuery.java
│ │ │ └── execution
│ │ │ │ ├── CollectionExecution.java
│ │ │ │ ├── Execution.java
│ │ │ │ ├── ModifyingQuery.java
│ │ │ │ └── SingleEntityExecution.java
│ │ └── support
│ │ │ ├── DctmAnnotationProcessor.java
│ │ │ ├── DctmContentQuery.java
│ │ │ ├── DctmEntityInformation.java
│ │ │ ├── DctmQueryLookupStrategy.java
│ │ │ ├── DctmRepositoryFactory.java
│ │ │ ├── DctmRepositoryFactoryBean.java
│ │ │ ├── QueryDslDctmRepository.java
│ │ │ ├── QueryDslDctmRepositoryWithContent.java
│ │ │ ├── SimpleDctmEntityInformation.java
│ │ │ ├── SimpleDctmRepository.java
│ │ │ └── SimpleDctmRepositoryWithContent.java
│ │ └── security
│ │ ├── DocumentumAuthenticationProvider.java
│ │ └── SecurityConfiguration.java
└── test
│ ├── java
│ └── com
│ │ └── emc
│ │ └── documentum
│ │ └── springdata
│ │ ├── ApplicationConfig.java
│ │ ├── LoanQueryDslDctmRepository.java
│ │ ├── LoanRepository.java
│ │ ├── Person.java
│ │ ├── PersonQueryDslRepository.java
│ │ ├── PersonRepository.java
│ │ ├── core
│ │ ├── Address.java
│ │ ├── Loan.java
│ │ ├── Person.java
│ │ └── tests
│ │ │ ├── DctmTemplateTest.java
│ │ │ ├── DocumentumTest.java
│ │ │ └── GenericCacheTest.java
│ │ ├── entitymanager
│ │ └── mapping
│ │ │ └── MappingHandlerTest.java
│ │ └── repository
│ │ ├── AbstractTest.java
│ │ ├── relation
│ │ ├── Address.java
│ │ ├── Person.java
│ │ ├── PersonRepositoryWithRelation.java
│ │ ├── RelationTest.java
│ │ └── mn
│ │ │ ├── Address.java
│ │ │ ├── AddressRepository.java
│ │ │ ├── ManyToManyRelationTest.java
│ │ │ ├── Person.java
│ │ │ └── PersonRepositoryWithRelationMn.java
│ │ └── support
│ │ ├── DctmRepositoryWithContentTest.java
│ │ ├── QueryDslDctmRepositoryTest.java
│ │ ├── QueryDslDctmRepositoryWithContentTest.java
│ │ ├── SimpleDctmRepositoryTest.java
│ │ └── StringBasedDctmQueryTest.java
│ └── resources
│ ├── dfc.properties
│ ├── log4j.properties
│ └── sample.pdf
├── test.txt
└── testsample.pdf
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #*.class
2 |
3 | # Package Files #
4 | *.jar
5 | *.war
6 | *.ear
7 |
8 | # logs
9 | *.log*
10 | /target/*
11 |
12 |
13 | /target/
14 | /documentum/*
15 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | spring-data-documentum
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.springframework.ide.eclipse.core.springbuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.ide.eclipse.core.springnature
26 | org.eclipse.jdt.core.javanature
27 | org.eclipse.m2e.core.maven2Nature
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding//src/test/java=UTF-8
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.7
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.source=1.7
14 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Spring Data for Documentum
2 | Spring data helps a developer remove all the boiler plate code to access a Data repository.
3 | Spring Data for Documentum allows Documentum developers to access Documentum Repository with minimum code. All developers have to write is Domain Class like Person.java or Contact.java and one interface. Spring Data for Documentum takes care of all the CRUD operation for the developer.
4 |
5 | A Spring Data for Documentum Sample can be found [here](https://github.com/waliaraman/spring-data-sample).
6 |
7 | ## Getting Started
8 |
9 | Add Spring Data for Documentum to your pom.xml and youa re ready to go.
10 | ````
11 |
12 | com.emc.documentum.spring
13 | spring-boot-starter-dctm
14 | 0.0.1
15 |
16 | ````
17 |
18 | This would ensure that you have all the dependencies needed to get started. As will all Spring Data projects, now all you need is create you domain objects
19 |
20 | ````
21 | @DctmEntity(repository = "contact")
22 | @Entity(name="contact")
23 | public class Contact {
24 |
25 | @Id
26 | protected String id;
27 |
28 | @DctmAttribute(value="object_name")
29 | private String name;
30 |
31 | public String getId() {
32 | return id;
33 | }
34 |
35 | public void setId(String id) {
36 | this.id = id;
37 | }
38 |
39 | public String getName() {
40 | return name;
41 | }
42 |
43 | public void setName(String name) {
44 | this.name = name;
45 | }
46 |
47 | }
48 |
49 | ````
50 |
51 |
52 | and expose them using DCTM Repository
53 |
54 | ````
55 | public interface ContactRepository extends DctmRepositoryWithContent {
56 |
57 | public Iterable findAll();
58 |
59 |
60 | public Iterable findByNameContaining(String value);
61 | }
62 |
63 | ````
64 |
65 | This would get you all the CRUD operations for Documentum Repository.
66 |
67 | If the same domain objects is needed to be exposed as a Rest Service, just include the Spring Data Rest dependency in your pom.xml
68 |
69 | ````
70 |
71 |
72 |
73 | org.springframework.boot
74 | spring-boot-starter-data-rest
75 |
76 |
77 |
78 | org.springframework.data
79 | spring-data-rest-webmvc
80 |
81 |
82 | ````
83 |
84 | Spring Data for Rest also hooks into Spring Security, so the Authentication would be done against the content server.
85 |
86 |
87 |
88 | ## Built With
89 |
90 | * Maven
91 |
92 |
--------------------------------------------------------------------------------
/atlassian-ide-plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/documentum/cache/7.1.1000.0037SP1/bof/FPIRepo/content.lck:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Enterprise-Content-Management/spring-data-dctm/c6bb5cda53d250f1b74b00336322ebaccc788f9d/documentum/cache/7.1.1000.0037SP1/bof/FPIRepo/content.lck
--------------------------------------------------------------------------------
/documentum/cache/7.1.1000.0037SP1/bof/FPIRepo/content.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/documentum/identityInterprocessMutex.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Enterprise-Content-Management/spring-data-dctm/c6bb5cda53d250f1b74b00336322ebaccc788f9d/documentum/identityInterprocessMutex.lock
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | com.emc.documentum.spring
6 | spring-data-documentum
7 | jar
8 | 0.0.1
9 |
10 |
11 |
12 |
13 |
14 | UTF-8
15 | UTF-8
16 |
17 |
18 | 1.1.3
19 |
20 |
21 | 3.2.3.RELEASE
22 |
23 |
24 | 4.2.1.Final
25 |
26 |
27 | 1.0.13
28 |
29 |
30 | 4.11
31 |
32 | 3.5.1
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | org.slf4j
41 | slf4j-api
42 | ${slf4j.version}
43 | compile
44 |
45 |
46 | ch.qos.logback
47 | logback-classic
48 | ${logback.version}
49 | runtime
50 |
51 |
52 |
53 |
54 | com.emc.documentum.dfc
55 | dfc
56 | 7.2-20160710.203551-32
57 |
58 |
59 |
60 |
61 | commons-beanutils
62 | commons-beanutils
63 | 1.8.3
64 |
65 |
66 | com.google.guava
67 | guava
68 | 18.0
69 |
70 |
71 |
72 | org.springframework.boot
73 | spring-boot-starter
74 | 1.2.2.RELEASE
75 |
76 |
77 | org.springframework.boot
78 | spring-boot-starter-security
79 |
80 |
81 | org.springframework.boot
82 | spring-boot-starter-test
83 | 1.2.2.RELEASE
84 |
85 |
86 | com.mysema.querydsl
87 | querydsl-mongodb
88 | ${querydsl.version}
89 | true
90 |
91 |
92 | com.mysema.querydsl
93 | querydsl-core
94 | ${querydsl.version}
95 | true
96 |
97 |
98 | com.mysema.querydsl
99 | querydsl-apt
100 | ${querydsl.version}
101 | provided
102 |
103 |
104 | org.springframework.data
105 | spring-data-commons
106 | 1.9.2.RELEASE
107 |
108 |
109 | org.aspectj
110 | aspectjweaver
111 | 1.8.0
112 |
113 |
114 | org.apache.openjpa
115 | openjpa
116 | 2.3.0
117 |
118 |
119 | javax.servlet
120 | javax.servlet-api
121 | 3.0.1
122 | provided
123 |
124 |
125 |
126 |
127 |
128 | com.emc.documentum.spring
129 | https://raw.github.com/mmohen/mvn-repo/gh-pages
130 |
131 | true
132 |
133 |
134 |
135 |
136 |
137 |
138 | org.springframework.boot
139 | spring-boot-starter-parent
140 | 1.2.2.RELEASE
141 |
142 |
143 |
144 |
145 |
146 | ossrh
147 | https://oss.sonatype.org/content/repositories/snapshots
148 |
149 |
150 | ossrh
151 | https://oss.sonatype.org/service/local/staging/deploy/maven2/
152 |
153 |
154 |
155 |
156 |
157 |
158 | org.apache.maven.plugins
159 | maven-compiler-plugin
160 |
161 | 1.7
162 | 1.7
163 |
164 |
165 |
166 |
167 |
168 | com.mysema.maven
169 | apt-maven-plugin
170 | ${apt}
171 |
172 |
173 | com.mysema.querydsl
174 | querydsl-apt
175 | ${querydsl.version}
176 |
177 |
178 |
179 |
180 | generate-test-sources
181 |
182 | test-process
183 |
184 |
185 | target/generated-test-sources
186 | com.emc.documentum.springdata.repository.support.DctmAnnotationProcessor
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 | org.apache.maven.plugins
195 | maven-source-plugin
196 | 2.2.1
197 |
198 |
199 | attach-sources
200 |
201 | jar-no-fork
202 |
203 |
204 |
205 |
206 |
207 | org.apache.maven.plugins
208 | maven-javadoc-plugin
209 | 2.9.1
210 |
211 |
212 | attach-javadocs
213 |
214 | jar
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 | org.apache.maven.plugins
223 | maven-gpg-plugin
224 |
225 |
226 | sign-artifacts
227 | verify
228 |
229 | sign
230 |
231 |
232 |
233 |
234 |
235 |
236 | org.sonatype.plugins
237 | nexus-staging-maven-plugin
238 | 1.6.7
239 | true
240 |
241 | ossrh
242 | https://oss.sonatype.org/
243 | true
244 | 526d3a6b674d2
245 |
246 |
247 |
248 |
249 |
250 |
251 |
--------------------------------------------------------------------------------
/spring-data-documentum.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/Application.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.ComponentScan;
6 |
7 | import com.documentum.fc.common.DfException;
8 |
9 | @SpringBootApplication
10 | @ComponentScan("com.emc.documentum.springdata")
11 | public class Application {
12 |
13 | public static void main(String[] args) throws DfException {
14 | SpringApplication.run(Application.class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/DctmAutoConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import com.emc.documentum.springdata.entitymanager.mapping.DctmMappingContext;
4 | import org.springframework.beans.BeanUtils;
5 | import org.springframework.beans.factory.BeanFactory;
6 | import org.springframework.beans.factory.config.BeanDefinition;
7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
10 | import org.springframework.context.annotation.Configuration;
11 | import org.springframework.core.type.filter.AnnotationTypeFilter;
12 | import org.springframework.data.annotation.Persistent;
13 | import org.springframework.data.mapping.model.FieldNamingStrategy;
14 | import org.springframework.util.ClassUtils;
15 | import org.springframework.util.StringUtils;
16 |
17 | import java.util.HashSet;
18 | import java.util.Set;
19 |
20 | /**
21 | * Copyright (c) 2015 EMC Corporation. All Rights Reserved.
22 | * EMC Confidential: Restricted Internal Distribution
23 | *
24 | * @author Raman Walia
25 | */
26 |
27 |
28 | @Configuration
29 | public class DctmAutoConfiguration {
30 |
31 | @Bean
32 | @ConditionalOnMissingBean
33 | public DctmMappingContext mongoMappingContext(BeanFactory beanFactory)
34 | throws ClassNotFoundException {
35 | DctmMappingContext context = new DctmMappingContext();
36 | return context;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/DctmOperations.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import java.util.List;
4 |
5 | import com.documentum.fc.common.DfException;
6 | import com.emc.documentum.springdata.repository.query.DctmQuery;
7 |
8 | public interface DctmOperations {
9 |
10 | T create(T objectToSave) throws DfException;
11 |
12 | String delete(T objectToDelete) throws DfException;
13 |
14 | String deleteById(ID objectToDeleteId) throws DfException;
15 |
16 | List findAll(Class entityClass) throws DfException;
17 |
18 | List find(DctmQuery query, Class entityClass) throws DfException;
19 |
20 | T findById(String id, Class entityClass) throws DfException;
21 |
22 | T update(T objectToUpdate) throws DfException;
23 |
24 | String getRepositoryObjectName(T obj);
25 |
26 | String getRepositoryName(Class> entityClass);
27 |
28 | long count(Class> entityClass) throws DfException;
29 |
30 | void setContent(T object, String contentType, String path) throws DfException;
31 |
32 | String getContent(T object, String path) throws DfException;
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/DctmTemplate.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.util.Assert;
8 |
9 | import com.documentum.fc.common.DfException;
10 | import com.emc.documentum.springdata.entitymanager.EntityPersistenceManager;
11 | import com.emc.documentum.springdata.entitymanager.EntityTypeHandler;
12 | import com.emc.documentum.springdata.repository.query.DctmQuery;
13 |
14 |
15 | @Controller
16 | public class DctmTemplate implements DctmOperations {
17 |
18 | private final EntityTypeHandler entityTypeManager;
19 | private final EntityPersistenceManager entityPersistenceManager;
20 |
21 | @Autowired
22 | public DctmTemplate(EntityPersistenceManager entityPersistenceManager, EntityTypeHandler entityTypeManager) {
23 | this.entityPersistenceManager = entityPersistenceManager;
24 | this.entityTypeManager = entityTypeManager;
25 | }
26 |
27 | @Override
28 | public T create(T objectToSave) throws DfException {
29 | Assert.notNull(objectToSave);
30 | String repoObjectName = getRepositoryObjectName(objectToSave);
31 | return entityPersistenceManager.createObject(repoObjectName, objectToSave);
32 | }
33 |
34 | @Override
35 | public String delete(T objectToDelete) throws DfException {
36 | Assert.notNull(objectToDelete);
37 | String repoObjectName = getRepositoryObjectName(objectToDelete);
38 | return entityPersistenceManager.deleteObject(repoObjectName, objectToDelete);
39 | }
40 |
41 | @Override
42 | public String deleteById(ID objectToDeleteId) throws DfException {
43 | Assert.notNull(objectToDeleteId);
44 | return entityPersistenceManager.deleteObject(objectToDeleteId.toString());
45 | }
46 |
47 | @Override
48 | public List findAll(Class entityClass) throws DfException {
49 | return find(null, entityClass);
50 | }
51 |
52 | @Override
53 | public List find(DctmQuery query, Class entityClass) throws DfException {
54 | Assert.notNull(entityClass);
55 | String repoObjectName = getRepositoryName(entityClass);
56 | return query == null ? doFindAll(entityClass, repoObjectName) : entityPersistenceManager.find(entityClass, repoObjectName, query);
57 | }
58 |
59 | private List doFindAll(Class entityClass, String repoObjectName) throws DfException {
60 | return entityPersistenceManager.findAllObjects(entityClass, repoObjectName);
61 | }
62 |
63 | @Override
64 | public T findById(String id, Class entityClass) throws DfException {
65 | Assert.notNull(id);
66 | Assert.notNull(entityClass);
67 | return entityPersistenceManager.findById(id, entityClass);
68 | }
69 |
70 | @Override
71 | public long count(Class> entityClass) throws DfException {
72 | Assert.notNull(entityClass);
73 | String repoObjectName = getRepositoryName(entityClass);
74 | return entityPersistenceManager.count(entityClass, repoObjectName);
75 | }
76 |
77 | @Override
78 | public T update(T objectToUpdate) throws DfException {
79 | return entityPersistenceManager.update(objectToUpdate);
80 | }
81 |
82 | @Override
83 | public String getRepositoryObjectName(T obj) {
84 | Assert.notNull(obj);
85 | return getRepositoryName(obj.getClass());
86 | }
87 |
88 | @Override
89 | public String getRepositoryName(Class> entityClass) {
90 | Assert.notNull(entityClass);
91 | return entityTypeManager.getEntityObjectName(entityClass);
92 | }
93 |
94 | @Override
95 | public void setContent(T object, String contentType, String path) throws DfException {
96 | entityPersistenceManager.setContent(object, contentType, path);
97 | }
98 |
99 | @Override
100 | public String getContent(T object, String path) throws DfException {
101 | return entityPersistenceManager.getContent(object, path);
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/Documentum.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import org.apache.log4j.Logger;
4 | import org.springframework.data.authentication.UserCredentials;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.util.Assert;
7 |
8 | import com.documentum.com.DfClientX;
9 | import com.documentum.fc.client.IDfClient;
10 | import com.documentum.fc.client.IDfSession;
11 | import com.documentum.fc.client.IDfSessionManager;
12 | import com.documentum.fc.client.IDfTypedObject;
13 | import com.documentum.fc.common.DfException;
14 | import com.documentum.fc.common.IDfLoginInfo;
15 |
16 | @Controller
17 | public class Documentum {
18 |
19 | private Logger logger = Logger.getLogger(Documentum.class);
20 | private UserCredentials credentials;
21 | private String docBase;
22 | private IDfSessionManager sessionManager;
23 |
24 |
25 | public Documentum() {
26 | }
27 |
28 | public void setCredentials(UserCredentials credentials) {
29 | this.credentials = credentials;
30 | }
31 |
32 | public void setDocBase(String docBase) {
33 | this.docBase = docBase;
34 | }
35 |
36 | public UserCredentials getCredentials() {
37 | return this.credentials;
38 | }
39 |
40 |
41 | public Documentum(UserCredentials credentials, String docBase, String docbrokerHost, String docbrokerPort)
42 | throws DfException {
43 |
44 | Assert.notNull(credentials);
45 | Assert.notNull(docBase);
46 |
47 | this.credentials = credentials;
48 | this.docBase = docBase;
49 |
50 | createSessionManager(credentials, docbrokerHost, docbrokerPort);
51 | }
52 |
53 | private void createSessionManager(UserCredentials credentials, String docbrokerHost, String docbrokerPort) throws DfException {
54 | DfClientX clientX = new DfClientX();
55 | IDfClient client = clientX.getLocalClient();
56 | IDfTypedObject config = client.getClientConfig();
57 |
58 | if (docbrokerHost != null && docbrokerPort != null) {
59 | config.setString("primary_host", docbrokerHost);
60 | config.setInt("primary_port", new Integer(docbrokerPort));
61 | }
62 |
63 | this.sessionManager = client.newSessionManager();
64 | IDfLoginInfo loginInfo = clientX.getLoginInfo();
65 | loginInfo.setUser(credentials.getUsername());
66 | loginInfo.setPassword(credentials.getPassword());
67 | sessionManager.setIdentity(IDfSessionManager.ALL_DOCBASES, loginInfo);
68 | logger.info("Session Manager Created");
69 | }
70 |
71 |
72 | public IDfSession getSession() throws DfException {
73 | if (sessionManager == null) {
74 | logger.info("Creating session manager");
75 | createSessionManager(this.credentials, null, null);
76 | logger.info("Created session manager");
77 | }
78 |
79 | try {
80 | return this.sessionManager.getSession(this.docBase);
81 | } catch (Exception e) {
82 | String msg = String.format(
83 | "Session cannot be instantiated for user %s for docBase %s. " + "Exception: %s, %s.", this.credentials.getUsername(), docBase, e.getClass(),
84 | e.getMessage()
85 | );
86 | logger.error(msg);
87 | throw new DfException(msg, e);
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/GenericCache.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core;
2 |
3 | import com.google.common.cache.CacheBuilder;
4 | import com.google.common.cache.Cache;
5 |
6 | import java.util.concurrent.TimeUnit;
7 |
8 | public class GenericCache {
9 |
10 | private static Cache< Object, Object > cache;
11 |
12 | public GenericCache() {
13 | createCache();
14 | }
15 |
16 | private synchronized void createCache() {
17 | if(cache == null){
18 | cache = CacheBuilder.newBuilder()
19 | .concurrencyLevel(4)
20 | .maximumSize(10000)
21 | .expireAfterWrite(10, TimeUnit.MINUTES)
22 | .build();
23 | }
24 | }
25 |
26 | public Object getEntry( Object key ) {
27 | try {
28 | return cache.getIfPresent( key );
29 | } catch (Exception e) {
30 | return null;
31 | }
32 | }
33 |
34 | public void setEntry(Object key, Object value){
35 | cache.asMap().put(key, value);
36 | }
37 | }
38 |
39 | //TODO: take all the concurrency properties for the user from a property file
40 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/core/exception/DSException.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.core.exception;
2 |
3 | /**
4 | * Created with IntelliJ IDEA.
5 | * User: ramanwalia
6 | * Date: 26/02/15
7 | * Time: 10:07 AM
8 | * To change this template use File | Settings | File Templates.
9 | */
10 | public class DSException extends Exception {
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/EntityTypeHandler.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager;
2 |
3 | import org.springframework.core.annotation.AnnotationUtils;
4 | import org.springframework.stereotype.Component;
5 | import org.springframework.util.Assert;
6 | import org.springframework.util.StringUtils;
7 |
8 | import com.emc.documentum.springdata.entitymanager.mapping.DctmEntity;
9 |
10 | @Component
11 | public class EntityTypeHandler {
12 |
13 | public String getEntityObjectName(Class> entityClass) {
14 | Assert.notNull(entityClass, "No class parameter provided, entity collection can't be determined!");
15 | return getEntityObjectNameFromClass(entityClass);
16 | }
17 |
18 | public String getEntityObjectNameFromClass(Class> type) {
19 | DctmEntity dctmObject = AnnotationUtils.findAnnotation(type, DctmEntity.class);
20 | return StringUtils.isEmpty(dctmObject.repository()) ? type.getSimpleName() : dctmObject.repository();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/annotations/Content.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.annotations;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | /**
8 | * * Annotation to indicate Content for dn_document DCTMObject.
9 | *
10 | */
11 |
12 | @Documented
13 | @Retention(RetentionPolicy.RUNTIME)
14 | public @interface Content {
15 |
16 | /**
17 | * The method to be performed on the content can either be "get" or "set".
18 | *
19 | */
20 |
21 | }
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/annotations/Relation.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.annotations;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Created with IntelliJ IDEA.
10 | * User: ramanwalia
11 | * Date: 20/03/15
12 | * Time: 9:30 PM
13 | * To change this template use File | Settings | File Templates.
14 | */
15 |
16 | @Retention(RetentionPolicy.RUNTIME)
17 | @Target(ElementType.FIELD)
18 | public @interface Relation {
19 | RelationshipType value() default RelationshipType.ONE_TO_ONE;
20 |
21 | String name();
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/annotations/RelationshipType.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.annotations;
2 |
3 | /*
4 | * Copyright (c) 2015 EMC Corporation. All Rights Reserved.
5 | * EMC Confidential: Restricted Internal Distribution
6 | */
7 | public enum RelationshipType{
8 | ONE_TO_MANY, ONE_TO_ONE
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/attributes/Attribute.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.attributes;
2 |
3 | import com.documentum.fc.common.DfException;
4 |
5 | public abstract class Attribute {
6 |
7 | protected int dfAttributeType;
8 | public String name;
9 |
10 | public int getDfAttributeType() {
11 | return dfAttributeType;
12 | }
13 |
14 | public Attribute(String name) {
15 | this.name = name;
16 | }
17 |
18 | public String getName() {
19 | return this.name;
20 | }
21 |
22 | public abstract T getValue(Object o) throws DfException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/attributes/AttributeFactory.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.attributes;
2 |
3 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isBoolean;
4 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isCollection;
5 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isDouble;
6 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isInteger;
7 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isLong;
8 | import static com.emc.documentum.springdata.entitymanager.attributes.TypeUtils.isString;
9 |
10 | import java.lang.reflect.Field;
11 | import java.lang.reflect.ParameterizedType;
12 | import java.lang.reflect.Type;
13 |
14 | import com.emc.documentum.springdata.entitymanager.annotations.Relation;
15 |
16 |
17 | public class AttributeFactory {
18 |
19 | public static Attribute> getAttribute(Field field, String attributeName) {
20 | Class> type = field.getType();
21 |
22 | if(isRelation(field)) {
23 | return getAttributeAsRelation(field, attributeName);
24 | } else if (isString(type)) {
25 | return new StringAttribute(attributeName);
26 | } else if (isInteger(type)) {
27 | return new IntAttribute(attributeName);
28 | } else if (isDouble(type)) {
29 | return new DoubleAttribute(attributeName);
30 | } else if (isLong(type)) {
31 | return new LongAttribute(attributeName);
32 | } else if (isBoolean(type)) {
33 | return new BooleanAttribute(attributeName);
34 | } else if (isCollection(type) && isString(getParameterizedType(field))) {
35 | return new StringListAttribute(attributeName);
36 | } else if (isCollection(type) && isInteger(getParameterizedType(field))) {
37 | return new IntListAttribute(attributeName);
38 | } else if (isCollection(type) && isDouble(getParameterizedType(field))) {
39 | return new DoubleListAttribute(attributeName);
40 | } else if (isCollection(type) && isLong(getParameterizedType(field))) {
41 | return new LongListAttribute(attributeName);
42 | } else if (isCollection(type) && isBoolean(getParameterizedType(field))) {
43 | return new BooleanListAttribute(attributeName);
44 | }
45 | return null;
46 | }
47 |
48 | private static Attribute> getAttributeAsRelation(Field field, String attributeName) {
49 | if(isCollection(field.getType())) {
50 | return new EntityCollectionAttribute<>(attributeName);
51 | } else {
52 | return new EntityAttribute<>(attributeName);
53 | }
54 | }
55 |
56 | private static boolean isRelation(Field field) {
57 | return field.getAnnotation(Relation.class) != null;
58 | }
59 |
60 | private static Type getParameterizedType(Field field) {
61 | field.setAccessible(true);
62 | return ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/attributes/AttributeType.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.attributes;
2 |
3 | import com.emc.documentum.springdata.entitymanager.annotations.RelationshipType;
4 |
5 | public class AttributeType {
6 |
7 | private final String fieldName;
8 | private final Attribute> attribute;
9 | private final boolean isRelation;
10 | private final String relationName;
11 | private final RelationshipType relationshipType;
12 | private final Class> relatedEntityClass;
13 |
14 | public AttributeType(String fieldName, Attribute> attribute) {
15 | this(fieldName, attribute, false, "", null, null);
16 | }
17 |
18 | public AttributeType(
19 | String fieldName, Attribute> attribute, boolean isRelation, String relationName, RelationshipType relationshipType, Class> relatedEntityClass
20 | ) {
21 | this.fieldName = fieldName;
22 | this.attribute = attribute;
23 | this.isRelation = isRelation;
24 | this.relationName = relationName;
25 | this.relationshipType = relationshipType;
26 | this.relatedEntityClass = relatedEntityClass;
27 | }
28 |
29 | public String getFieldName() {
30 | return this.fieldName;
31 | }
32 |
33 | public Attribute> getAttribute() {
34 | return this.attribute;
35 | }
36 |
37 | public boolean isRelation() {
38 | return isRelation;
39 | }
40 |
41 | public String getRelationName() {
42 | return relationName;
43 | }
44 |
45 | public Class> getRelatedEntityClass() {
46 | return relatedEntityClass;
47 | }
48 |
49 | public RelationshipType getRelationshipType() {
50 | return relationshipType;
51 | }
52 |
53 | @Override
54 | public String toString() {
55 | return "AttributeType{" +
56 | "fieldName='" + fieldName + '\'' +
57 | ", attribute=" + attribute +
58 | ", isRelation=" + isRelation +
59 | ", relationName='" + relationName + '\'' +
60 | ", relationshipType=" + relationshipType +
61 | ", relatedEntityClass=" + relatedEntityClass +
62 | '}';
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/attributes/BooleanAttribute.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.attributes;
2 |
3 | import com.documentum.fc.client.IDfTypedObject;
4 | import com.documentum.fc.common.DfException;
5 |
6 | public class BooleanAttribute extends Attribute {
7 |
8 | public BooleanAttribute(String name) {
9 | super(name);
10 | dfAttributeType = 0;
11 | }
12 |
13 | @Override
14 | public Boolean getValue(Object o) throws DfException {
15 | return ((IDfTypedObject) o).getBoolean(name);
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/src/main/java/com/emc/documentum/springdata/entitymanager/attributes/BooleanListAttribute.java:
--------------------------------------------------------------------------------
1 | package com.emc.documentum.springdata.entitymanager.attributes;
2 |
3 | import com.documentum.fc.client.IDfSysObject;
4 | import com.documentum.fc.client.IDfTypedObject;
5 | import com.documentum.fc.common.DfException;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 |
11 | public class BooleanListAttribute extends IterableAttribute> {
12 |
13 | public BooleanListAttribute(java.lang.String name) {
14 | super(name);
15 | }
16 |
17 | @Override
18 | public List getValue(Object o) throws DfException {
19 | List values = new ArrayList();
20 | IDfTypedObject obj = (IDfTypedObject) o;
21 | int size = obj.getValueCount(name);
22 |
23 | for (int i = 0 ; i < size; i++)
24 | values.add(obj.getRepeatingBoolean(name,i));
25 |
26 | return values;
27 | }
28 |
29 | @Override
30 | public void setValue(IDfSysObject dctmObject, List