Package com.javaeye.jert.service.impl

Source Code of com.javaeye.jert.service.impl.ReportDefinitionServiceDefaultImpl

package com.javaeye.jert.service.impl;
import java.util.Iterator;
import java.util.List;
import com.javaeye.core.service.AbstractService;
import com.javaeye.jert.domain.Database;
import com.javaeye.jert.domain.DrillDownColumn;
import com.javaeye.jert.domain.ReportDefinition;
import com.javaeye.jert.domain.connection.ConnectionManager;
import com.javaeye.jert.service.ReportDefinitionService;

/**
* @author Quake Wang
* @since 2004-12-22
* @version $Revision: 1.8 $
*/
public class ReportDefinitionServiceDefaultImpl extends AbstractService implements ReportDefinitionService {
    private ConnectionManager connectionManager;
   
    public ReportDefinition getReportDefinition(Long id) {
        ReportDefinition rd = (ReportDefinition) loadById(ReportDefinition.class, id);
        //TODO: how to fix these code?
        if(rd == null) return null;
        rd.getDatabase().setConnectionManager(connectionManager);
        return rd;
    }

    public List getReportDefinitions() {
        return findAll(ReportDefinition.class);
    }

    public void createReportDefinition(ReportDefinition rd) {
        rd.setupDefaultParameterDefinition();
        create(rd);
    }

    public void updateReportDefinition(ReportDefinition rd) {
        rd.setupDefaultParameterDefinition();
        update(rd);
    }

    public void deleteReportDefinition(ReportDefinition rd) {
        Database db = rd.getDatabase();
        db.removeReportDefinition(rd);
        //TODO How to Automatically Update the PersistenceCollection from the Second Cache?
        for(Iterator it=rd.getAssociatedDrillDownColumns().iterator();it.hasNext();){
            DrillDownColumn drillDownColumn=(DrillDownColumn)it.next();
            drillDownColumn.getReportDefinition().removeDrillDownColumn(drillDownColumn);
        }
        delete(rd);
    }
   
    public void setConnectionManager(ConnectionManager connectionManager) {
        this.connectionManager = connectionManager;
    }   
}
TOP

Related Classes of com.javaeye.jert.service.impl.ReportDefinitionServiceDefaultImpl

TOP
Copyright © 2018 www.massapi.com. 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.