001: /*******************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/shared/mgt/impl/WrappedStructuredArtifactFinder.java $
003: * $Id: WrappedStructuredArtifactFinder.java 19408 2006-12-11 23:52:11Z john.ellis@rsmart.com $
004: * **********************************************************************************
005: *
006: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: ******************************************************************************/package org.sakaiproject.metaobj.shared.mgt.impl;
021:
022: import org.sakaiproject.content.api.ContentHostingService;
023: import org.sakaiproject.content.api.ContentResource;
024: import org.sakaiproject.metaobj.shared.mgt.AgentManager;
025: import org.sakaiproject.metaobj.shared.mgt.IdManager;
026: import org.sakaiproject.metaobj.shared.model.Id;
027: import org.sakaiproject.metaobj.shared.model.Agent;
028: import org.sakaiproject.metaobj.shared.model.ContentResourceArtifact;
029: import org.sakaiproject.metaobj.shared.model.MimeType;
030: import org.sakaiproject.entity.api.ResourceProperties;
031:
032: import java.util.Collection;
033: import java.util.List;
034: import java.util.ArrayList;
035: import java.util.Iterator;
036:
037: /**
038: * Created by IntelliJ IDEA.
039: * User: johnellis
040: * Date: Dec 11, 2006
041: * Time: 8:48:47 AM
042: * To change this template use File | Settings | File Templates.
043: */
044: public class WrappedStructuredArtifactFinder extends FileArtifactFinder {
045:
046: private ContentHostingService contentHostingService;
047: private AgentManager agentManager;
048: private IdManager idManager;
049:
050: public Collection findByOwnerAndType(Id owner, String type) {
051: List artifacts = getContentHostingService().findResources(type,
052: null, null);
053:
054: Collection returned = new ArrayList();
055:
056: for (Iterator i = artifacts.iterator(); i.hasNext();) {
057: ContentResource resource = (ContentResource) i.next();
058: Agent resourceOwner = getAgentManager().getAgent(
059: resource.getProperties().getProperty(
060: ResourceProperties.PROP_CREATOR));
061: Id resourceId = getIdManager().getId(
062: getContentHostingService()
063: .getUuid(resource.getId()));
064: returned.add(new ContentResourceArtifact(resource,
065: resourceId, resourceOwner));
066: }
067:
068: return returned;
069: }
070:
071: public Collection findByOwnerAndType(Id owner, String type,
072: MimeType mimeType) {
073: return null;
074: }
075:
076: public Collection findByOwner(Id owner) {
077: return null;
078: }
079:
080: public Collection findByWorksiteAndType(Id worksiteId, String type) {
081: return null;
082: }
083:
084: public Collection findByWorksite(Id worksiteId) {
085: return null;
086: }
087:
088: public Collection findByType(String type) {
089: return null;
090: }
091:
092: public boolean getLoadArtifacts() {
093: return false;
094: }
095:
096: public void setLoadArtifacts(boolean loadArtifacts) {
097:
098: }
099:
100: public ContentHostingService getContentHostingService() {
101: return contentHostingService;
102: }
103:
104: public void setContentHostingService(
105: ContentHostingService contentHostingService) {
106: this .contentHostingService = contentHostingService;
107: }
108:
109: public AgentManager getAgentManager() {
110: return agentManager;
111: }
112:
113: public void setAgentManager(AgentManager agentManager) {
114: this .agentManager = agentManager;
115: }
116:
117: public IdManager getIdManager() {
118: return idManager;
119: }
120:
121: public void setIdManager(IdManager idManager) {
122: this.idManager = idManager;
123: }
124: }
|