01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/matrix/api-impl/src/java/org/theospi/portfolio/matrix/model/impl/MatrixContentEntityProducer.java $
03: * $Id: MatrixContentEntityProducer.java 17650 2006-10-31 20:05:53Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.theospi.portfolio.matrix.model.impl;
21:
22: import java.util.List;
23:
24: import org.apache.commons.logging.Log;
25: import org.apache.commons.logging.LogFactory;
26: import org.sakaiproject.entity.api.Entity;
27: import org.sakaiproject.entity.api.EntityTransferrer;
28: import org.sakaiproject.metaobj.shared.mgt.EntityProducerBase;
29: import org.sakaiproject.service.legacy.resource.DuplicatableToolService;
30:
31: /**
32: * Created by IntelliJ IDEA.
33: * User: John Ellis
34: * Date: Nov 8, 2005
35: * Time: 5:27:48 PM
36: * To change this template use File | Settings | File Templates.
37: */
38: public class MatrixContentEntityProducer extends EntityProducerBase
39: implements EntityTransferrer {
40: public static final String MATRIX_PRODUCER = "ospMatrix";
41: protected final Log logger = LogFactory.getLog(getClass());
42: private DuplicatableToolService matrixManager;
43:
44: public String getLabel() {
45: return MATRIX_PRODUCER;
46: }
47:
48: public void init() {
49: logger.info("init()");
50: try {
51: getEntityManager().registerEntityProducer(this ,
52: Entity.SEPARATOR + MATRIX_PRODUCER);
53: } catch (Exception e) {
54: logger.warn(
55: "Error registering Matrix Content Entity Producer",
56: e);
57: }
58: }
59:
60: public void transferCopyEntities(String fromContext,
61: String toContext, List ids) {
62: matrixManager.importResources(fromContext, toContext, ids);
63: }
64:
65: /**
66: * {@inheritDoc}
67: */
68: public String[] myToolIds() {
69: String[] toolIds = { "osp.matrix" };
70: return toolIds;
71: }
72:
73: public void setMatrixManager(DuplicatableToolService matrixManager) {
74: this.matrixManager = matrixManager;
75: }
76: }
|