01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/shared/mgt/impl/MetaobjEntityProducer.java $
03: * $Id: MetaobjEntityProducer.java 17650 2006-10-31 20:05:53Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 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.sakaiproject.metaobj.shared.mgt.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.metaobj.shared.mgt.MetaobjEntityManager;
30: import org.sakaiproject.metaobj.shared.mgt.ReferenceParser;
31: import org.sakaiproject.service.legacy.resource.DuplicatableToolService;
32:
33: /**
34: * Created by IntelliJ IDEA.
35: * User: John Ellis
36: * Date: Feb 21, 2006
37: * Time: 1:23:17 PM
38: * To change this template use File | Settings | File Templates.
39: */
40: public class MetaobjEntityProducer extends EntityProducerBase implements
41: EntityTransferrer {
42:
43: protected final Log logger = LogFactory.getLog(getClass());
44: private DuplicatableToolService structuredArtifactDefinitionManager;
45:
46: public String getLabel() {
47: return MetaobjEntityManager.METAOBJ_ENTITY_PREFIX;
48: }
49:
50: public void init() {
51: logger.info("init()");
52: try {
53: getEntityManager()
54: .registerEntityProducer(
55: this ,
56: Entity.SEPARATOR
57: + MetaobjEntityManager.METAOBJ_ENTITY_PREFIX);
58: } catch (Exception e) {
59: logger.warn("Error registering MetaObj Entity Producer", e);
60: }
61: }
62:
63: protected ReferenceParser parseReference(String wholeRef) {
64: return new ReferenceParser(wholeRef, this , false);
65: }
66:
67: public void transferCopyEntities(String fromContext,
68: String toContext, List ids) {
69: getStructuredArtifactDefinitionManager().importResources(
70: fromContext, toContext, ids);
71: }
72:
73: public String[] myToolIds() {
74: String[] toolIds = { "sakai.metaobj" };
75: return toolIds;
76: }
77:
78: public DuplicatableToolService getStructuredArtifactDefinitionManager() {
79: return structuredArtifactDefinitionManager;
80: }
81:
82: public void setStructuredArtifactDefinitionManager(
83: DuplicatableToolService structuredArtifactDefinitionManager) {
84: this.structuredArtifactDefinitionManager = structuredArtifactDefinitionManager;
85: }
86:
87: }
|