Exporters for Images, some bug fixes
git-svn-id: https://svn.libreccm.org/ccm/trunk@5727 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a212bb7b37
commit
1594b79ce9
|
|
@ -29,23 +29,28 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.runtime.DomainInitEvent;
|
||||
|
||||
import org.libreccm.export.ExportManager;
|
||||
import org.librecms.assets.ImageAttachmentsExporter;
|
||||
|
||||
/**
|
||||
* Initializes the imagestep content item asset.
|
||||
*
|
||||
* @version $Id: ItemImageAttachmentInitializer.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*
|
||||
* @version $Id: ItemImageAttachmentInitializer.java 287 2005-02-22 00:29:02Z
|
||||
* sskracic $
|
||||
*/
|
||||
public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
||||
|
||||
/**
|
||||
* Constructor, sets its specific manifest file and delegates to super class.
|
||||
* Constructor, sets its specific manifest file and delegates to super
|
||||
* class.
|
||||
*/
|
||||
public ItemImageAttachmentInitializer() {
|
||||
super("ccm-cms-assets-imagestep.pdl.mf");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ev
|
||||
*
|
||||
* @param ev
|
||||
*/
|
||||
@Override
|
||||
public void init(DomainInitEvent ev) {
|
||||
|
|
@ -53,9 +58,10 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
super.init(ev);
|
||||
|
||||
DomainObjectFactory.registerInstantiator(
|
||||
ItemImageAttachment.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
@Override
|
||||
ItemImageAttachment.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject obj) {
|
||||
return new ItemImageAttachment(obj);
|
||||
}
|
||||
|
|
@ -66,17 +72,21 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//register checker in ReusableImage
|
||||
ReusableImageAsset.registerImageInUseChecker(new ImageInUseCheck());
|
||||
|
||||
ExportManager
|
||||
.getInstance()
|
||||
.registerExporter(new ImageAttachmentsExporter());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The base type against which the asset is defined,
|
||||
* typically com.arsdigita.cms.ContentPage
|
||||
* The base type against which the asset is defined, typically
|
||||
* com.arsdigita.cms.ContentPage
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public String getBaseType() {
|
||||
return ContentPage.BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
|
@ -85,17 +95,17 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
* Returns the path to the XML file defintions for the asset, eg:
|
||||
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/" +
|
||||
"cms/contentassets/ItemImageAttachment.xml";
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/"
|
||||
+ "cms/contentassets/ItemImageAttachment.xml";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the association between the item
|
||||
* and the asset, eg 'fileAttachments'.
|
||||
* The name of the association between the item and the asset, eg
|
||||
* 'fileAttachments'.
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public String getProperty() {
|
||||
return "imageAttachments";
|
||||
}
|
||||
|
|
@ -103,7 +113,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The class of the authoring kit step
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public Class getAuthoringStep() {
|
||||
return ImageStep.class;
|
||||
}
|
||||
|
|
@ -111,25 +121,27 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The label for the authoring step
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepLabel() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
return new GlobalizedMessage(
|
||||
"com.arsdigita.cms.contentassets.image_step_label",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
}
|
||||
|
||||
/**
|
||||
* The description for the authoring step
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepDescription() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
return new GlobalizedMessage(
|
||||
"com.arsdigita.cms.contentassets.image_step_description",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
}
|
||||
|
||||
/**
|
||||
* The sort key for the authoring step
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public int getAuthoringStepSortKey() {
|
||||
return ItemImageAttachmentConfig.instanceOf().getImageStepSortKey();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
package org.librecms.assets;
|
||||
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ReusableImageAsset;
|
||||
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.WebConfig;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonEncoding;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import org.libreccm.export.AbstractDomainObjectsExporter;
|
||||
import org.libreccm.export.IdSequence;
|
||||
import org.librecms.contentsection.AbstractAttachmentListsExporter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ImageAttachmentsExporter
|
||||
extends AbstractDomainObjectsExporter<ContentItem> {
|
||||
|
||||
@Override
|
||||
public Class<ContentItem> exportsType() {
|
||||
|
||||
return ContentItem.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String exportsBaseDataObjectType() {
|
||||
|
||||
return ContentItem.BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertsToType() {
|
||||
|
||||
return "org.librecms.contentsection.ItemAttachment";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean includeSubTypes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> exportDomainObject(
|
||||
final ContentItem item, final Path targetDir) {
|
||||
|
||||
final String listUuid = AbstractAttachmentListsExporter
|
||||
.generateListUuid(item, "images");
|
||||
|
||||
final List<String> attachmentsUuids = new ArrayList<>();
|
||||
|
||||
final DataCollection imageAttachments = ItemImageAttachment
|
||||
.getImageAttachments(item);
|
||||
|
||||
long sortKey = 0;
|
||||
while (imageAttachments.next()) {
|
||||
|
||||
sortKey++;
|
||||
final String uuid = exportImageAttachment(imageAttachments
|
||||
.getDataObject(),
|
||||
listUuid,
|
||||
sortKey,
|
||||
targetDir);
|
||||
attachmentsUuids.add(uuid);
|
||||
}
|
||||
|
||||
return attachmentsUuids;
|
||||
}
|
||||
|
||||
private String exportImageAttachment(final DataObject dataObj,
|
||||
final String listUuid,
|
||||
final long sortKey,
|
||||
final Path targetDir) {
|
||||
|
||||
final ItemImageAttachment imageAttachment = new ItemImageAttachment(
|
||||
dataObj);
|
||||
final ReusableImageAsset imageAsset = imageAttachment.getImage();
|
||||
final String imageAssetUuid = generateUuid(imageAsset);
|
||||
|
||||
final byte[] uuidSource = String.format(
|
||||
"%s/images/%s",
|
||||
WebConfig.getInstanceOf().getSiteName(),
|
||||
imageAttachment.getOID().toString())
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
final String uuid = UUID.nameUUIDFromBytes(uuidSource).toString();
|
||||
|
||||
final Path targetFilePath = generateTargetFilePath(targetDir, uuid);
|
||||
final File targetFile = targetFilePath.toFile();
|
||||
|
||||
final JsonFactory jsonFactory = new JsonFactory();
|
||||
try (JsonGenerator jsonGenerator = jsonFactory
|
||||
.createGenerator(targetFile, JsonEncoding.UTF8)) {
|
||||
|
||||
jsonGenerator.writeStartObject();
|
||||
|
||||
jsonGenerator.writeNumberField("attachmentId",
|
||||
IdSequence.getInstance().nextId());
|
||||
jsonGenerator.writeStringField("uuid", uuid);
|
||||
|
||||
jsonGenerator.writeStringField("attachmentList", listUuid);
|
||||
jsonGenerator.writeStringField("asset", imageAssetUuid);
|
||||
|
||||
jsonGenerator.writeNumberField("sortKey", sortKey);
|
||||
|
||||
jsonGenerator.writeEndObject();
|
||||
|
||||
} catch (IOException ex) {
|
||||
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -85,7 +85,14 @@ import com.arsdigita.xml.XML;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.export.ExportManager;
|
||||
import org.librecms.contentsection.AbstractAttachmentListsExporter;
|
||||
import org.librecms.assets.ImagesExporter;
|
||||
import org.librecms.contentsection.ContentSectionsExporter;
|
||||
import org.librecms.contentsection.ContentTypesExporter;
|
||||
import org.librecms.contentsection.FoldersExporter;
|
||||
import org.librecms.lifecycle.LifecycleDefinitionsExporter;
|
||||
import org.librecms.lifecycle.LifecyclesExporter;
|
||||
import org.librecms.lifecycle.PhaseDefinitionsExporter;
|
||||
import org.librecms.lifecycle.PhasesExporter;
|
||||
import org.librecms.workflow.CmsTasksExporter;
|
||||
|
||||
/**
|
||||
|
|
@ -97,9 +104,13 @@ import org.librecms.workflow.CmsTasksExporter;
|
|||
*/
|
||||
public class Initializer extends CompoundInitializer {
|
||||
|
||||
/** Creates a s_logging category with name = to the full name of class */
|
||||
/**
|
||||
* Creates a s_logging category with name = to the full name of class
|
||||
*/
|
||||
private static Logger s_log = Logger.getLogger(Initializer.class);
|
||||
/** Configuration object for the CMS module */
|
||||
/**
|
||||
* Configuration object for the CMS module
|
||||
*/
|
||||
private static final CMSConfig s_conf = CMSConfig.getInstanceOf();
|
||||
|
||||
/**
|
||||
|
|
@ -114,7 +125,8 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf",
|
||||
new NameFilter(DbHelper
|
||||
.getDatabaseSuffix(database),
|
||||
.getDatabaseSuffix(
|
||||
database),
|
||||
"pdl"))));
|
||||
|
||||
add(new com.arsdigita.cms.contentsection.Initializer());
|
||||
|
|
@ -126,8 +138,8 @@ public class Initializer extends CompoundInitializer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes domain-coupling machinery, usually consisting of
|
||||
* registering object instantiators and observers.
|
||||
* Initializes domain-coupling machinery, usually consisting of registering
|
||||
* object instantiators and observers.
|
||||
*/
|
||||
@Override
|
||||
public void init(DomainInitEvent e) {
|
||||
|
|
@ -137,25 +149,29 @@ public class Initializer extends CompoundInitializer {
|
|||
/* Register object instantiator for ContentCenter (Content Center) */
|
||||
e.getFactory().registerInstantiator(ContentCenter.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dobj) {
|
||||
return new ContentCenter(dobj);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dobj) {
|
||||
return new ContentCenter(dobj);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
LanguageUtil.setSupportedLanguages(
|
||||
Kernel.getConfig().getSupportedLanguages());
|
||||
Kernel.getConfig().getSupportedLanguages());
|
||||
|
||||
/* Register object instantiator for CMS Service */
|
||||
e.getFactory().registerInstantiator(Service.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dobj) {
|
||||
return new Service(dobj);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dobj) {
|
||||
return new Service(dobj);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
URLService.registerFinder(ContentPage.BASE_DATA_OBJECT_TYPE,
|
||||
new ItemURLFinder());
|
||||
|
|
@ -167,22 +183,24 @@ public class Initializer extends CompoundInitializer {
|
|||
new AssetURLFinder());
|
||||
|
||||
URLService.registerFinder(
|
||||
Link.BASE_DATA_OBJECT_TYPE,
|
||||
new URLFinder() {
|
||||
Link.BASE_DATA_OBJECT_TYPE,
|
||||
new URLFinder() {
|
||||
|
||||
public String find(OID oid, String context)
|
||||
throws NoValidURLException {
|
||||
throws NoValidURLException {
|
||||
|
||||
return find(oid);
|
||||
}
|
||||
|
||||
public String find(OID oid)
|
||||
throws NoValidURLException {
|
||||
throws NoValidURLException {
|
||||
|
||||
Link link;
|
||||
try {
|
||||
link = (Link) DomainObjectFactory.newInstance(oid);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new NoValidURLException("Cannot find an object with oid: " + oid);
|
||||
throw new NoValidURLException(
|
||||
"Cannot find an object with oid: " + oid);
|
||||
}
|
||||
|
||||
if (Link.EXTERNAL_LINK.equals(link.getTargetType())) {
|
||||
|
|
@ -224,18 +242,21 @@ public class Initializer extends CompoundInitializer {
|
|||
// Just set the class implementing methods run when for publishing
|
||||
// or unpublishing to file. No initialisation of the class here.
|
||||
try {
|
||||
QueueManager.setListener((PublishToFileListener) ContentSection.getConfig()
|
||||
.getPublishToFileClass().newInstance());
|
||||
QueueManager.setListener((PublishToFileListener) ContentSection
|
||||
.getConfig()
|
||||
.getPublishToFileClass().newInstance());
|
||||
} catch (InstantiationException ex) {
|
||||
throw new UncheckedWrapperException("Failed to instantiate the listener class", ex);
|
||||
throw new UncheckedWrapperException(
|
||||
"Failed to instantiate the listener class", ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
throw new UncheckedWrapperException("Couldn't access the listener class", ex);
|
||||
throw new UncheckedWrapperException(
|
||||
"Couldn't access the listener class", ex);
|
||||
}
|
||||
|
||||
MetadataProviderRegistry.registerAdapter(
|
||||
FileAsset.BASE_DATA_OBJECT_TYPE,
|
||||
new AssetMetadataProvider());
|
||||
|
||||
FileAsset.BASE_DATA_OBJECT_TYPE,
|
||||
new AssetMetadataProvider());
|
||||
|
||||
//Register the ApplicationManager implementations provided by this module
|
||||
ApplicationManagers.register(new ContentCenterAppManager());
|
||||
ApplicationManagers.register(new ServiceAppManager());
|
||||
|
|
@ -243,18 +264,28 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
if (s_conf.getAttachPersonOrgaUnitsStep()) {
|
||||
AuthoringKitWizard.registerAssetStep(
|
||||
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
||||
GenericPersonOrgaUnitsStep.class,
|
||||
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
||||
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
||||
s_conf.getPersonOrgaUnitsStepSortKey());
|
||||
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
||||
GenericPersonOrgaUnitsStep.class,
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"person.authoring.orgas.title"),
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"person.authoring.orgas.title"),
|
||||
s_conf.getPersonOrgaUnitsStepSortKey());
|
||||
}
|
||||
|
||||
ExportManager.getInstance().registerExporter(new CmsTasksExporter());
|
||||
// ExportManager
|
||||
// .getInstance()
|
||||
// .registerExporter(new AbstractAttachmentListsExporter());
|
||||
|
||||
ExportManager.getInstance().registerExporter(new CmsTasksExporter());
|
||||
ExportManager
|
||||
.getInstance()
|
||||
.registerExporter(new ContentSectionsExporter());
|
||||
ExportManager.getInstance().registerExporter(new ContentTypesExporter());
|
||||
ExportManager.getInstance().registerExporter(new FoldersExporter());
|
||||
ExportManager.getInstance().registerExporter(new ImagesExporter());
|
||||
ExportManager.getInstance().registerExporter(new LifecyclesExporter());
|
||||
ExportManager.getInstance()
|
||||
.registerExporter(new LifecycleDefinitionsExporter());
|
||||
ExportManager.getInstance().registerExporter(
|
||||
new PhaseDefinitionsExporter());
|
||||
ExportManager.getInstance().registerExporter(new PhasesExporter());
|
||||
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
|
||||
} // END init(DomainInitEvent e)
|
||||
|
||||
|
|
@ -263,12 +294,12 @@ public class Initializer extends CompoundInitializer {
|
|||
*/
|
||||
private void registerPatternGenerators() {
|
||||
PatternStylesheetResolver.registerPatternGenerator(
|
||||
"item_template_oid",
|
||||
new ItemTemplatePatternGenerator());
|
||||
"item_template_oid",
|
||||
new ItemTemplatePatternGenerator());
|
||||
|
||||
PatternStylesheetResolver.registerPatternGenerator(
|
||||
"item_delegated_url",
|
||||
new ItemDelegatedURLPatternGenerator());
|
||||
"item_delegated_url",
|
||||
new ItemDelegatedURLPatternGenerator());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -279,83 +310,98 @@ public class Initializer extends CompoundInitializer {
|
|||
// Register the CMSTaskInstaniator
|
||||
f.registerInstantiator(CMSTask.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new CMSTask(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new CMSTask(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
f.registerInstantiator(CMSTaskType.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new CMSTaskType(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new CMSTaskType(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
f.registerInstantiator(TaskEventURLGenerator.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new TaskEventURLGenerator(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new TaskEventURLGenerator(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
f.registerInstantiator(Workflow.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new Workflow(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new Workflow(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
f.registerInstantiator(WorkflowTemplate.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new WorkflowTemplate(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new WorkflowTemplate(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
f.registerInstantiator(TemplateContext.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new TemplateContext(dataObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObjectInstantiator resolveInstantiator(DataObject obj) {
|
||||
return this;
|
||||
}
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new TemplateContext(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObjectInstantiator resolveInstantiator(
|
||||
DataObject obj) {
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
f.registerInstantiator(RelationAttribute.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new RelationAttribute(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public DomainObject doNewInstance(
|
||||
DataObject dataObject) {
|
||||
return new RelationAttribute(dataObject);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void registerLuceneEngine() {
|
||||
|
||||
QueryEngineRegistry.registerEngine(IndexerType.LUCENE,
|
||||
new FilterType[]{
|
||||
new CategoryFilterType(),
|
||||
new ContentSectionFilterType(),
|
||||
new CMSContentSectionFilterType(),
|
||||
new ContentTypeFilterType(),
|
||||
new CreationDateFilterType(),
|
||||
new CreationUserFilterType(),
|
||||
new LastModifiedDateFilterType(),
|
||||
new LastModifiedUserFilterType(),
|
||||
new ObjectTypeFilterType(),
|
||||
new PermissionFilterType(),
|
||||
new VersionFilterType()
|
||||
},
|
||||
new CategoryFilterType(),
|
||||
new ContentSectionFilterType(),
|
||||
new CMSContentSectionFilterType(),
|
||||
new ContentTypeFilterType(),
|
||||
new CreationDateFilterType(),
|
||||
new CreationUserFilterType(),
|
||||
new LastModifiedDateFilterType(),
|
||||
new LastModifiedUserFilterType(),
|
||||
new ObjectTypeFilterType(),
|
||||
new PermissionFilterType(),
|
||||
new VersionFilterType()
|
||||
},
|
||||
new LuceneQueryEngine());
|
||||
}
|
||||
|
||||
|
|
@ -363,19 +409,19 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
QueryEngineRegistry.registerEngine(IndexerType.INTERMEDIA,
|
||||
new FilterType[]{
|
||||
new CategoryFilterType(),
|
||||
new ContentSectionFilterType(),
|
||||
new CMSContentSectionFilterType(),
|
||||
new ContentTypeFilterType(),
|
||||
new CreationDateFilterType(),
|
||||
new CreationUserFilterType(),
|
||||
new LastModifiedDateFilterType(),
|
||||
new LastModifiedUserFilterType(),
|
||||
new LaunchDateFilterType(),
|
||||
new ObjectTypeFilterType(),
|
||||
new PermissionFilterType(),
|
||||
new VersionFilterType()
|
||||
},
|
||||
new CategoryFilterType(),
|
||||
new ContentSectionFilterType(),
|
||||
new CMSContentSectionFilterType(),
|
||||
new ContentTypeFilterType(),
|
||||
new CreationDateFilterType(),
|
||||
new CreationUserFilterType(),
|
||||
new LastModifiedDateFilterType(),
|
||||
new LastModifiedUserFilterType(),
|
||||
new LaunchDateFilterType(),
|
||||
new ObjectTypeFilterType(),
|
||||
new PermissionFilterType(),
|
||||
new VersionFilterType()
|
||||
},
|
||||
new IntermediaQueryEngine());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package org.librecms.assets;
|
||||
|
||||
import com.arsdigita.cms.ReusableImageAsset;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import org.librecms.contentsection.AbstractBinaryAssetsExporter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ImagesExporter
|
||||
extends AbstractBinaryAssetsExporter<ReusableImageAsset> {
|
||||
|
||||
@Override
|
||||
protected void exportBinaryAssetProperties(
|
||||
final ReusableImageAsset asset, final JsonGenerator jsonGenerator)
|
||||
throws IOException {
|
||||
|
||||
jsonGenerator.writeNumberField("width", asset.getWidth());
|
||||
jsonGenerator.writeNumberField("height", asset.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ReusableImageAsset> exportsType() {
|
||||
|
||||
return ReusableImageAsset.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String exportsBaseDataObjectType() {
|
||||
|
||||
return ReusableImageAsset.BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertsToType() {
|
||||
|
||||
return "org.librecms.assets.Image";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,7 +27,8 @@ import java.util.UUID;
|
|||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ContentTypesExporter extends AbstractDomainObjectsExporter<ContentType> {
|
||||
public class ContentTypesExporter
|
||||
extends AbstractDomainObjectsExporter<ContentType> {
|
||||
|
||||
@Override
|
||||
public Class<ContentType> exportsType() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue