entityaccesseventprocessor.java

来自「国外的一套开源CRM」· Java 代码 · 共 85 行

JAVA
85
字号
/*
 * 
 * Copyright (c) 2004 SourceTap - www.sourcetap.com
 *
 *  The contents of this file are subject to the SourceTap Public License 
 * ("License"); You may not use this file except in compliance with the 
 * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 */

package com.sourcetap.sfa.security;

import java.util.List;

import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericValue;

import com.sourcetap.sfa.event.GenericEventProcessor;
import com.sourcetap.sfa.util.UserInfo;


/**
 * DOCUMENT ME!
 *
 */
public class EntityAccessEventProcessor extends GenericEventProcessor {

    /**
     * DOCUMENT ME!
     *
     * @param userInfo 
     * @param delegator 
     * @param originatingEntityName 
     * @param entityGV 
     *
     * @return 
     */
    public int deleteAllRelated(UserInfo userInfo, GenericDelegator delegator,
        String originatingEntityName, GenericValue entityGV) {

        int status = STATUS_CONTINUE;

        // Delete related teams.
        status = deleteOneRelated(userInfo, delegator, entityGV, "", "Team",
                originatingEntityName, new TeamEventProcessor());

        if (status != STATUS_CONTINUE) {
            return status;
        }

        return STATUS_CONTINUE;
    }

    /**
     * DOCUMENT ME!
     *
     * @param userInfo 
     * @param delegator 
     * @param entityGV 
     * @param relationTitle 
     * @param relatedEntityName 
     *
     * @return 
     */
    public List findOneRelated(UserInfo userInfo, GenericDelegator delegator,
        GenericValue entityGV, String relationTitle, String relatedEntityName) {
        // Find instances of an entity related to the current entity so the instances can be deleted.

        if (relatedEntityName.equals("Team")) {
            return TeamHelper.findRelated(userInfo, delegator, entityGV,
                relationTitle);
        } else {
            // Not finding EntityAccess records.  Just use the standard processing using relations.
            return super.findOneRelated(userInfo, delegator, entityGV,
                relationTitle, relatedEntityName);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?