001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/shared/mgt/StructuredArtifactDefinitionManager.java $
003: * $Id: StructuredArtifactDefinitionManager.java 27831 2007-03-26 22:29:08Z 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;
021:
022: import org.jdom.Element;
023: import org.sakaiproject.content.api.ContentResource;
024: import org.sakaiproject.exception.*;
025: import org.sakaiproject.metaobj.shared.mgt.home.StructuredArtifactHomeInterface;
026: import org.sakaiproject.metaobj.shared.model.Id;
027: import org.sakaiproject.metaobj.shared.model.StructuredArtifactDefinitionBean;
028: import org.sakaiproject.metaobj.shared.model.Artifact;
029: import org.sakaiproject.metaobj.shared.model.ElementBean;
030:
031: import java.io.IOException;
032: import java.io.InputStream;
033: import java.io.OutputStream;
034: import java.util.Collection;
035: import java.util.List;
036: import java.util.Map;
037:
038: public interface StructuredArtifactDefinitionManager {
039: public final static String GLOBAL_SAD_QUALIFIER = "theospi.share.sad.global";
040:
041: public Map getHomes();
042:
043: /**
044: * @param worksiteId
045: * @return a map with all worksite and global homes
046: */
047: public Map getWorksiteHomes(Id worksiteId);
048:
049: public Map getWorksiteHomes(Id worksiteId, boolean includeHidden);
050:
051: public List findHomes();
052:
053: public List findHomes(boolean includeHidden);
054:
055: public Map findCategorizedHomes(boolean includeHidden);
056:
057: /**
058: * @return list of all published globals or global sad owned by current user
059: */
060: public List findGlobalHomes();
061:
062: /**
063: * @param currentWorksiteId
064: * @return list of globally published sads or published sad in currentWorksiteId or sads in
065: * currentWorksiteId owned by current user
066: */
067: public List findHomes(Id currentWorksiteId);
068:
069: /**
070: *
071: * @param currentWorksiteId
072: * @param includeHidden include forms marked as hidden when created
073: * @return list of globally published sads or published sad in currentWorksiteId or sads in
074: * currentWorksiteId owned by current user
075: */
076: public List findHomes(Id currentWorksiteId, boolean includeHidden);
077:
078: /**
079: *
080: * @param resource The ContentResource of a file in resources that is the xsd file
081: * @return A list of StructuredArtifactDefinitionBean objects
082: */
083: public List findBySchema(ContentResource resource);
084:
085: public StructuredArtifactDefinitionBean loadHome(String type);
086:
087: public StructuredArtifactDefinitionBean loadHome(Id id);
088:
089: public StructuredArtifactDefinitionBean loadHomeByExternalType(
090: String externalType, Id worksiteId);
091:
092: public StructuredArtifactDefinitionBean save(
093: StructuredArtifactDefinitionBean sad);
094:
095: public StructuredArtifactDefinitionBean save(
096: StructuredArtifactDefinitionBean sad, boolean updateModDate);
097:
098: public void delete(StructuredArtifactDefinitionBean sad);
099:
100: /**
101: * @return true if user is in a SAD tool that is configured to manipulate globals SADs
102: */
103: public boolean isGlobal();
104:
105: public Collection getRootElements(
106: StructuredArtifactDefinitionBean sad);
107:
108: public void validateSchema(StructuredArtifactDefinitionBean sad);
109:
110: public StructuredArtifactHomeInterface convertToHome(
111: StructuredArtifactDefinitionBean sad);
112:
113: public boolean importSADResource(Id worksiteId, String resourceId,
114: boolean findExisting) throws IOException,
115: ServerOverloadException, PermissionException,
116: IdUnusedException, ImportException,
117: UnsupportedFileTypeException;
118:
119: /**
120: * This is the default method for exporting a form into a stream. This method does check the
121: * form export permission.
122: * @param formId String
123: * @param os OutputStream
124: * @throws IOException
125: */
126: public void packageFormForExport(String formId, OutputStream os)
127: throws IOException;
128:
129: /**
130: * This method will export a form into a stream. It has the ability to turn off checking
131: * for the export form permission.
132: * @param formId String
133: * @param os OutputStream
134: * @param checkPermission boolean
135: * @throws IOException
136: */
137: public void packageFormForExport(String formId, OutputStream os,
138: boolean checkPermission) throws IOException;
139:
140: public StructuredArtifactDefinitionBean importSad(Id worksiteId,
141: InputStream in, boolean findExisting, boolean publish)
142: throws IOException, ImportException;
143:
144: public StructuredArtifactDefinitionBean importSad(Id worksiteId,
145: InputStream in, boolean findExisting, boolean publish,
146: boolean foundThrowsException) throws IOException,
147: ImportException;
148:
149: public Element createFormViewXml(String formId, String returnUrl);
150:
151: public Element createFormViewXml(Artifact art, String returnUrl);
152:
153: public Element createFormViewXml(ElementBean bean, String returnUrl);
154:
155: public InputStream getTransformer(String type, boolean readOnly);
156:
157: public boolean hasHomes();
158:
159: public void addConsumer(FormConsumer consumer);
160:
161: List findHomes(Id currentWorksiteId, boolean includeHidden,
162: boolean includeGlobal);
163: }
|