Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Extends directory persistance unit

First you need to define your JPA entities and the persistence.xml file in your bundle classpath.

Then you can extends the directory persistence unit with your JPA entities by consuming the directory JPA service and then calling the addSubPersistenceBundle method.

An example  example :

Code Block
themeRDark
@Component
@Provides(properties= {@StaticServiceProperty(name="targetArianeComponent", type="java.lang.String", value="Portal")})
@Instantiate
public class RabbitmqDirectoryBootstrap implements FaceletsResourceResolverService {
    private static final Logger log = LoggerFactory.getLogger(RabbitmqDirectoryBootstrap.class);
    private static final String RBMQ_DIRECTORY_PLUGIN = "Ariane RabbitMQ Plugin Directory";
    private static final String basePath = "/META-INF";
    private static final String FACES_CONFIG_FILE_PATH= basePath + "/faces-config.xml";
    private static final String REST_EP_FILE_PATH = basePath + "/rest.endpoints";
    private static String MAIN_MENU_DIRECTORY_CONTEXT;


    @Requires
    private DirectoryJPAProvider directoryJpaProvider = null;
    private static DirectoryJPAProvider directoryJPAProviderSgt = null;


    @Bind
    public void bindJPAProvider(DirectoryJPAProvider r) {
        log.debug("Bound to directory JPA provider...");
        directoryJpaProvider = r;
        directoryJPAProviderSgt = r;
    }


    @Unbind
    public void unbindJPAProvider() {
        log.debug("Unbound from directory JPA provider...");
        directoryJpaProvider = null;
        directoryJPAProviderSgt = null;
    }
 
...
 
    @Validate
    public void validate() throws Exception {
        plugDirectoryJPAProvider();
        plugPortalFacesMBeanRegistry();
        plugDirectoryTreeMenuRootRegistry();
        plugRESTEndpoints();
        log.info("{} is started", new Object[]{RBMQ_DIRECTORY_PLUGIN});
    }
 
...
 
    private void plugDirectoryJPAProvider() {
        Company pivotal = null;
        Application rabbitmq = null;
        directoryJpaProvider.addSubPersistenceBundle(FrameworkUtil.getBundle(RabbitmqDirectoryBootstrap.class));
		
		...
 
	}
 
...
 
}

 

Extends directory tree menu

You can extends the directory tree menu by consuming the directory tree menu roots registry and adding your own tree menu entities.

Keep in mind you need to define the instance.name of the service you're consuming : 

Code Block
themeRDark
@Requires(from="DirectoryMenuRootsTreeRegistryImpl")
private TreeMenuRootsRegistry rootDirectoryRegistry;

TreeMenuRootsRegistry is a tool defined on portal (and implemented by directory), check (again) the portal doc to know more on how to use it.