⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uiscreensectioneventprocessor.java

📁 国外的一套开源CRM
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * 
 * 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.customization;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;

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


/**
 * DOCUMENT ME!
 *
 */
public class UIScreenSectionEventProcessor extends GenericEventProcessor {
	public static final String module = UIScreenSectionEventProcessor.class.getName();

    /**
     * DOCUMENT ME!
     *
     * @param userInfo 
     * @param delegator 
     * @param dataMatrix 
     *
     * @return 
     */
    protected int postInsert(UserInfo userInfo, GenericDelegator delegator,
        DataMatrix dataMatrix) {

        // Get the current values.
        GenericValue uiScreenSectionGV = dataMatrix.getCurrentBuffer()
                                                   .getGenericValue(0, 0);
        String sectionId = uiScreenSectionGV.getString("sectionId");

        // Get the original values so we can see if this is a copy or a regular insert.
        GenericValue uiScreenSectionGVOrig = dataMatrix.getOriginalBuffer()
                                                       .getGenericValue(0, 0);
        String sectionIdOrig = uiScreenSectionGVOrig.getString("sectionId");

        if (sectionIdOrig.equals("") || (sectionIdOrig == null)) {
            // The display object ID was not filled in yet when the screen was displayed last.  This is
            // a regular insert.  Just let it proceed normally.
        } else {
            // This is a copy of an existing screen section.

            //////////
            // Copy all the screen section entities from the original screen section.
            //////////
            HashMap uiScreenSectionEntityFindMap = new HashMap();
            uiScreenSectionEntityFindMap.put("sectionId", sectionIdOrig);

            try {
                // Get the List of original screen section entities.
                List uiScreenSectionEntityGVLOrig = delegator.findByAnd("UiScreenSectionEntity",
                        uiScreenSectionEntityFindMap);
                Iterator uiScreenSectionEntityGVIOrig = uiScreenSectionEntityGVLOrig.iterator();
                ModelEntity uiScreenSectionEntityME = delegator.getModelEntity(
                        "UiScreenSectionEntity");

                while (uiScreenSectionEntityGVIOrig.hasNext()) {
                    GenericValue uiScreenSectionEntityGVOrig = (GenericValue) uiScreenSectionEntityGVIOrig.next();
                    String entityIdOrig = (uiScreenSectionEntityGVOrig.getString(
                            "entityId") == null) ? ""
                                                 : uiScreenSectionEntityGVOrig.getString(
                            "entityId");


                    // Get values from the original screen section entity.
                    String isUpdateableOrig = (uiScreenSectionEntityGVOrig.getString(
                            "isUpdateable") == null) ? ""
                                                     : uiScreenSectionEntityGVOrig.getString(
                            "isUpdateable");
                    String relationTitleOrig = (uiScreenSectionEntityGVOrig.getString(
                            "relationTitle") == null) ? ""
                                                      : uiScreenSectionEntityGVOrig.getString(
                            "relationTitle");
                    String relationByAndFieldsOrig = (uiScreenSectionEntityGVOrig.getString(
                            "relationByAndFields") == null) ? ""
                                                            : uiScreenSectionEntityGVOrig.getString(
                            "relationByAndFields");
                    String relationOrderByFieldsOrig = (uiScreenSectionEntityGVOrig.getString(
                            "relationOrderByFields") == null) ? ""
                                                              : uiScreenSectionEntityGVOrig.getString(
                            "relationOrderByFields");
                    String retrieveOrderOrig = (uiScreenSectionEntityGVOrig.getString(
                            "retrieveOrder") == null) ? ""
                                                      : uiScreenSectionEntityGVOrig.getString(
                            "retrieveOrder");
                    String insertOrderOrig = (uiScreenSectionEntityGVOrig.getString(
                            "insertOrder") == null) ? ""
                                                    : uiScreenSectionEntityGVOrig.getString(
                            "insertOrder");
                    String updateOrderOrig = (uiScreenSectionEntityGVOrig.getString(
                            "updateOrder") == null) ? ""
                                                    : uiScreenSectionEntityGVOrig.getString(
                            "updateOrder");
                    String deleteOrderOrig = (uiScreenSectionEntityGVOrig.getString(
                            "deleteOrder") == null) ? ""
                                                    : uiScreenSectionEntityGVOrig.getString(
                            "deleteOrder");
                    String isOuterJoinedOrig = (uiScreenSectionEntityGVOrig.getString(
                            "isOuterJoined") == null) ? ""
                                                      : uiScreenSectionEntityGVOrig.getString(
                            "isOuterJoined");
                    String hasSequenceKeyOrig = (uiScreenSectionEntityGVOrig.getString(
                            "hasSequenceKey") == null) ? ""
                                                       : uiScreenSectionEntityGVOrig.getString(
                            "hasSequenceKey");

                    // Create the new screen section entity using the new section ID.
                    GenericValue uiScreenSectionEntityGV = new GenericValue(uiScreenSectionEntityME);
                    uiScreenSectionEntityGV.setDelegator(delegator);
                    uiScreenSectionEntityGV.set("sectionId", sectionId);
                    uiScreenSectionEntityGV.set("entityId", entityIdOrig);
                    uiScreenSectionEntityGV.set("isUpdateable", isUpdateableOrig);
                    uiScreenSectionEntityGV.set("relationTitle",
                        relationTitleOrig);
                    uiScreenSectionEntityGV.set("relationByAndFields",
                        relationByAndFieldsOrig);
                    uiScreenSectionEntityGV.set("relationOrderByFields",
                        relationOrderByFieldsOrig);
                    uiScreenSectionEntityGV.set("retrieveOrder",
                        Long.valueOf(retrieveOrderOrig));
                    uiScreenSectionEntityGV.set("insertOrder",
                        Long.valueOf(insertOrderOrig));
                    uiScreenSectionEntityGV.set("updateOrder",
                        Long.valueOf(updateOrderOrig));
                    uiScreenSectionEntityGV.set("deleteOrder",
                        Long.valueOf(deleteOrderOrig));
                    uiScreenSectionEntityGV.set("isOuterJoined",

⌨️ 快捷键说明

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