Skip to content

Commit

Permalink
Merge pull request #21 from sgirardin/correction/transfer-easyContent…
Browse files Browse the repository at this point in the history
…2MetadataDocument-to-test

Correction/transfer easy content2 metadata document to test
  • Loading branch information
davidantonlou authored Oct 26, 2018
2 parents 58dce76 + d9d47e1 commit 399ca8b
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 388 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import java.util.List;
import java.util.Map;

import static org.alfresco.events.types.DataType.Qname;

public class DataListsResolver {

private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
Expand All @@ -24,17 +22,17 @@ public class DataListsResolver {
private StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");

public Map<String, String> getValuesByType(NodeRef documentToExtractMetadata){
List<NodeRef> datalistValues = getExtractorDatalist();
List<NodeRef> datalistValues = getExtractorDatalistValues();
return getMappingsByConfigurationAndType(datalistValues, documentToExtractMetadata, ConfigurationEnum.VALUE);
}

public Map<String, String> getRegexByType(NodeRef documentToExtractMetadata){
List<NodeRef> datalistValues = getExtractorDatalist();
List<NodeRef> datalistValues = getExtractorDatalistValues();
return getMappingsByConfigurationAndType(datalistValues, documentToExtractMetadata, ConfigurationEnum.REGEX);
}

public Map<String, String> getCoordinatesByType(NodeRef documentToExtractMetadata){
List<NodeRef> datalistValues = getExtractorDatalist();
List<NodeRef> datalistValues = getExtractorDatalistValues();
return getMappingsByConfigurationAndType(datalistValues, documentToExtractMetadata,ConfigurationEnum.COORDINATES);
}

Expand All @@ -50,7 +48,7 @@ public Map<String, String> getMappingsByConfigurationAndType(List<NodeRef> datal
}

public boolean hasMappings(String documentModel){
List<NodeRef> datalistValues = getExtractorDatalist();
List<NodeRef> datalistValues = getExtractorDatalistValues();
for (NodeRef nodeRef : datalistValues) {
if (nodeService.getProperty(nodeRef, Constants.PROP_TYPE).equals(documentModel)) {
return true;
Expand All @@ -59,7 +57,7 @@ public boolean hasMappings(String documentModel){
return false;
}

private List<NodeRef> getExtractorDatalist(){
public List<NodeRef> getExtractorDatalistValues(){
String query ="TYPE:\""+ Constants.EXTRACTOR_MAPPING_TYPE_LIST +"\"";
ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, query);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
ec2m_easyContent2MetadataDocument.type.ec2m_document.title=Document Type
ec2m_easyContent2MetadataDocument.property.ec2m_author.title=Document Author
ec2m_easyContent2MetadataDocument.property.ec2m_city.title=City
ec2m_easyContent2MetadataDocument.property.ec2m_date.title=Date
form.datalist.active.message=Should the field be extracted?
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@
</constraints>

<types>
<type name="ec2m:easyContent2MetadataDocument">
<title>EasyContent2Metadata Document Type Example</title>
<parent>cm:content</parent>
<properties>
<property name="ec2m:author">
<title>Document Author</title>
<type>d:text</type>
</property>
<property name="ec2m:city">
<title>City</title>
<type>d:text</type>
</property>
<property name="ec2m:date">
<title>Date</title>
<type>d:date</type>
</property>
</properties>
</type>

<type name="ec2m:extractorMappingDatalist">
<title>Extractor Mapping Datalist</title>
<parent>dl:dataListItem</parent>
Expand Down
Loading

0 comments on commit 399ca8b

Please sign in to comment.