Search in sources :

Example 11 with MetaAction

use of com.axelor.meta.db.MetaAction in project axelor-open-suite by axelor.

the class StudioMetaService method removeMetaActions.

/**
 * Removes MetaActions from comma separated names in string.
 *
 * @param actionNames Comma separated string of action names.
 */
@Transactional
public void removeMetaActions(String xmlIds) {
    log.debug("Removing actions: {}", xmlIds);
    if (xmlIds == null) {
        return;
    }
    List<MetaAction> metaActions = metaActionRepo.all().filter("self.xmlId in ?1 OR self.name in ?1 ", Arrays.asList(xmlIds.split(","))).fetch();
    for (MetaAction action : metaActions) {
        List<MetaMenu> menus = metaMenuRepo.all().filter("self.action = ?1", action).fetch();
        for (MetaMenu metaMenu : menus) {
            metaMenu.setAction(null);
            metaMenuRepo.save(metaMenu);
        }
        metaActionRepo.remove(action);
    }
}
Also used : MetaMenu(com.axelor.meta.db.MetaMenu) MetaAction(com.axelor.meta.db.MetaAction) Transactional(com.google.inject.persist.Transactional)

Aggregations

MetaAction (com.axelor.meta.db.MetaAction)11 Transactional (com.google.inject.persist.Transactional)6 MetaMenu (com.axelor.meta.db.MetaMenu)4 Group (com.axelor.auth.db.Group)2 Role (com.axelor.auth.db.Role)2 RoleRepository (com.axelor.auth.db.repo.RoleRepository)2 MetaMenuRepository (com.axelor.meta.db.repo.MetaMenuRepository)2 ObjectViews (com.axelor.meta.schema.ObjectViews)2 ActionView (com.axelor.meta.schema.actions.ActionView)2 ArrayList (java.util.ArrayList)2 WkfInstanceService (com.axelor.apps.bpm.service.execution.WkfInstanceService)1 User (com.axelor.auth.db.User)1 GroupRepository (com.axelor.auth.db.repo.GroupRepository)1 UserRepository (com.axelor.auth.db.repo.UserRepository)1 MetaJsonRecord (com.axelor.meta.db.MetaJsonRecord)1 MetaView (com.axelor.meta.db.MetaView)1 MetaActionRepository (com.axelor.meta.db.repo.MetaActionRepository)1 Action (com.axelor.meta.schema.actions.Action)1 ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)1 AbstractWidget (com.axelor.meta.schema.views.AbstractWidget)1