Package org.fao.geonet.repository

Examples of org.fao.geonet.repository.MetadataNotificationRepository


                notificationTarget = parameterToNotificationTarget(parameter, notificationTarget);
                notificationTargets.put(identifier, notificationTarget);
            }

        }
        final MetadataNotificationRepository notificationRepository = context.getBean(MetadataNotificationRepository.class);
        final MetadataNotifierRepository notifierRepository = context.getBean(MetadataNotifierRepository.class);

        for(NotificationTarget notificationTarget : notificationTargets.values()) {
            final MetadataNotifier metadataNotifier = new MetadataNotifier();
            metadataNotifier.setName(notificationTarget.getName());
            metadataNotifier.setUsername(notificationTarget.getUsername());
            metadataNotifier.setPassword(notificationTarget.getPassword());
            metadataNotifier.setUrl(notificationTarget.getUrl());
            metadataNotifier.setEnabled(notificationTarget.isEnabled());

            // insert
            if (!notificationTarget.isPreExisting() && StringUtils.isNotBlank(notificationTarget.getName())
                    && StringUtils.isNotBlank(notificationTarget.getUrl())) {

                notifierRepository.save(metadataNotifier);
            } else if(notificationTarget.isPreExisting()) {
                // pre-existing
                String id = notificationTarget.getId();
                // delete
                if(notificationTarget.getName() == null) {
                    int iid = Integer.parseInt(id);
                    notificationRepository.deleteAllWithNotifierId(iid);
                    notifierRepository.delete(iid);
                } else {
                    // update
                    notifierRepository.save(metadataNotifier);
                }
View Full Code Here

TOP

Related Classes of org.fao.geonet.repository.MetadataNotificationRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.