Page tree
Skip to end of metadata
Go to start of metadata

Introduction

Current implement:

Follow JIRA ticket:

info.magnolia.module.dependencies.field.DependenciesFieldDefinition is hard-code for dam and website workspace, so It just used for page app only. We should support other workspaces. BTW, referenceProperties is affected to all fields, in case user only want to configure specific properties for a field.

Node name

Value

 modules

 

 dependencies

 

 dialogs

 

 fieldTypes

 

 config

 

 referenceProperties

 

 contact

contact

 image

 image

 link

 link

 teaserImg

 teaserImg

Goal

  • Workspace and property are configurable
  • This field can use for other app, not only page app.

Configuration for field

  • Reference from field
    Idea: get uuid from node belong to property, then find node by uuid on workspace.
    Config:
    • add properties node into field definition
    • <referenceProperty>: specific property name should be find in node to get the reference. Separated by (,)
    • <workspace>: Specfic the workspace which search the reference node on. Separated by (,)
    • [title]: the title of reference group
  • Reference to field
    Idea: scan current node UUID in specific workspaces to get reference
    Config:
    • add properties node into field definition
    • <workspace>: Specfic the workspace which search the reference node on. Separated by (,)
    • [title]: the title of reference groupConfiguration for field

General configuration

Idea: each workspace has difference properties. Such as nodeType, appMapping, ... And for getting path or name from a node, we have some difference ways. That why we have this configuration

Config:

    • Add resolvers node in parent config and each proprerty node has:
    • [resolverClass] the class extends from info.magnolia.module.dependencies.resolver.Resolver, if not configure, the default info.magnolia.module.dependencies.resolver.DefaultResolver is used
    • <workspace> key for resolver, will search resolver on this property
    • [appMapping] uses to specific app to open reference node, the pattern is APP_TYPE:APP_NAME:SUB_APP_NAME. If it is not configured, link is removed
    • [nodeType]: uses in query a node with UUID in workspace, return node type should be specficed. Default is NodeTypes.Content.NAME or mgnl:content

The result

Refactoring

  • Definition:

Create new class for property definition: info.magnolia.module.dependencies.field.PropertyDefinition

/**
 * PropertyDefinition for {@link DependenciesField}.
 */
public interface ReferencePropertyDefinition {
	String getName();
    @I18nText
    String getTitle();
    String getWorkspace();
    String getReferenceProperty();
}


Add property list to info.magnolia.module.dependencies.field.ReferenceFieldDefinition

List<ReferencePropertyDefinition> getProperties();
  • Service

Move logic from info.magnolia.module.dependencies.Dependencies to info.magnolia.module.dependencies.DependencyService.

Move info.magnolia.module.dependencies.field.DependenciesField to info.magnolia.module.dependencies.field.ReferenceField


Mask the old one to Deprecated

 

  • No labels