com.pureinfo.srm.view.function.ShowOtherPartnersFunctionHandler.java Source code

Java tutorial

Introduction

Here is the source code for com.pureinfo.srm.view.function.ShowOtherPartnersFunctionHandler.java

Source

/**
 * PureInfo Quake
 * @(#)ShowPartnerFunctionHandler.java   1.0 2006-6-6
 * 
 * Copyright(c) 2004-2005, PureInfo Information Technology Corp. Ltd. 
 * All rights reserved, see the license file.
 * 
 * www.pureinfo.com.cn
 */

package com.pureinfo.srm.view.function;

import org.apache.commons.lang.StringUtils;

import com.pureinfo.dolphin.model.DolphinObject;
import com.pureinfo.dolphinview.context.model.IDVContext;
import com.pureinfo.dolphinview.parser.function.FunctionHandlerDVImplBase;
import com.pureinfo.force.exception.PureException;
import com.pureinfo.srm.honor.model.Honor;
import com.pureinfo.srm.product.model.Product;
import com.pureinfo.srm.project.model.Project;

/**
 * <P>
 * Created on 2006-6-6 13:34:22<BR>
 * Last modified on 2006-6-6
 * </P>
 * 
 * 
 * @author elmar.chen
 * @version 1.0, 2006-6-6
 * @since Quake 1.0 
 */
public class ShowOtherPartnersFunctionHandler extends FunctionHandlerDVImplBase {

    /**
     * @see com.pureinfo.dolphinview.parser.function.FunctionHandlerDVImplBase#perform(java.lang.Object[], com.pureinfo.dolphinview.context.model.IDVContext)
     */
    public Object perform(Object[] _args, IDVContext _context) throws PureException {
        DolphinObject obj = _context.getObject();
        String sSeperator = " ";
        if (_args.length > 0) {
            sSeperator = (String) _args[0];
        }
        String[] sNames = new String[0];
        if (obj instanceof Project) {
            sNames = ((Project) obj).getOtherAuthors();
        } else if (obj instanceof Product) {
            sNames = ((Product) obj).getOtherAuthors();
        } else if (obj instanceof Honor) {
            sNames = ((Honor) obj).getOtherAuthors();
        }
        return StringUtils.join(sNames, sSeperator);
    }

}