001: /*
002: The contents of this file are subject to the Common Public Attribution License
003: Version 1.0 (the "License"); you may not use this file except in compliance with
004: the License. You may obtain a copy of the License at
005: http://www.projity.com/license . The License is based on the Mozilla Public
006: License Version 1.1 but Sections 14 and 15 have been added to cover use of
007: software over a computer network and provide for limited attribution for the
008: Original Developer. In addition, Exhibit A has been modified to be consistent
009: with Exhibit B.
010:
011: Software distributed under the License is distributed on an "AS IS" basis,
012: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
013: specific language governing rights and limitations under the License. The
014: Original Code is OpenProj. The Original Developer is the Initial Developer and
015: is Projity, Inc. All portions of the code written by Projity are Copyright (c)
016: 2006, 2007. All Rights Reserved. Contributors Projity, Inc.
017:
018: Alternatively, the contents of this file may be used under the terms of the
019: Projity End-User License Agreeement (the Projity License), in which case the
020: provisions of the Projity License are applicable instead of those above. If you
021: wish to allow use of your version of this file only under the terms of the
022: Projity License and not to allow others to use your version of this file under
023: the CPAL, indicate your decision by deleting the provisions above and replace
024: them with the notice and other provisions required by the Projity License. If
025: you do not delete the provisions above, a recipient may use your version of this
026: file under either the CPAL or the Projity License.
027:
028: [NOTE: The text of this license may differ slightly from the text of the notices
029: in Exhibits A and B of the license at http://www.projity.com/license. You should
030: use the latest text at http://www.projity.com/license for your modifications.
031: You may not remove this license text from the source files.]
032:
033: Attribution Information: Attribution Copyright Notice: Copyright © 2006, 2007
034: Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj,
035: an open source solution from Projity. Attribution URL: http://www.projity.com
036: Graphic Image as provided in the Covered Code as file: openproj_logo.png with
037: alternatives listed on http://www.projity.com/logo
038:
039: Display of Attribution Information is required in Larger Works which are defined
040: in the CPAL as a work which combines Covered Code or portions thereof with code
041: not governed by the terms of the CPAL. However, in addition to the other notice
042: obligations, all copies of the Covered Code in Executable and Source Code form
043: distributed must, as a form of attribution of the original author, include on
044: each user interface screen the "OpenProj" logo visible to all users. The
045: OpenProj logo should be located horizontally aligned with the menu bar and left
046: justified on the top left of the screen adjacent to the File menu. The logo
047: must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it
048: must direct them back to http://www.projity.com.
049: */
050: package com.projity.script;
051:
052: import java.util.List;
053:
054: import com.projity.script.object.LiteField;
055: import com.projity.script.object.LiteProject;
056: import com.projity.script.object.LiteResource;
057: import com.projity.script.object.LiteTask;
058: import com.projity.script.object.ReportData;
059:
060: /**
061: * Will be subclassed for client and server (ajax) versions
062: *
063: * This will be used for:
064: * AJAX communication to server
065: * Real-time collaboration
066: * and later on
067: * as an API (with the advantage of being a sandbox - only can access this package
068: * Macros
069: * Logging
070: * Journaling
071: * Possibly using journaling as a way of saving projects instead of sending all data?
072: * Should this be tied to undo?
073: * And wrapped by bsh or groovy for formulas and filters
074: * Need to add exception handling where needed
075: *
076: */
077: public interface ScriptRunner {
078: public static final int TASK = 1;
079: public static final int RESOURCE = 2;
080: public static final int PROJECT = 3;
081: public static final int ASSIGNMENT = 4;
082:
083: public static final int PROJECT_DESCRIPTOR = 100;
084: public static final int PROJECT_DESCRIPTOR_AS_TASK = 101;
085: public static final int RESOURCE_AS_TASK = 102;
086: public static final int RESOURCE_USAGE = 103;
087: public static final int USER = 200;
088:
089: public static final long PORTFOLIO_PROJECT_ID = 100000L;
090: public static final long RESOURCE_USAGE_PROJECT_ID = 200000L;
091: public static final long RESOURCE_ASSIGNMENT_PROJECT_ID = 1000000000000000L;
092:
093: public List getProjectDescriptors();
094:
095: public List getUsers();
096:
097: public LiteProject createProject(String name) throws Exception;
098:
099: public void saveProject(long projectId) throws Exception;
100:
101: public void saveProjectAs(long projectId, String name)
102: throws Exception;
103:
104: public void closeProject(long projectId) throws Exception;
105:
106: public void closeProject(Long ids[]) throws Exception;
107:
108: /**
109: * Returns all the tasks of a project.
110: * Opens the project if it's not already opened
111: * @param projectId
112: * @return the content of the project
113: */
114: public LiteProject getProject(long projectId) throws Exception;
115:
116: // public LiteResourcePool getResourcePool(long projectId) throws Exception;
117: // public LiteProject getPortfolio() throws Exception;
118: // public LiteProject getResourcePoolWithUsage() throws Exception;
119: // /**
120: // * Returns all the tasks of a project.
121: // * Opens the project if it's not already opened
122: // * @param projectId
123: // * @param explorationMaxLevel 1: returns only the parent tasks, 2: returns the parent tasks and their children ...
124: // * @return the content of the project
125: // */
126: // public LiteProject getProject(long projectId,int explorationMaxLevel) throws Exception;
127: // public LiteResourcePool getResourcePool(long projectId,int explorationMaxLevel) throws Exception;
128:
129: public LiteProject setValue(long projectId, String fieldId,
130: int type, long id, String value, boolean returnChanges)
131: throws Exception;
132:
133: /**
134: *
135: * @param projectId
136: * @param type
137: * @param previousId
138: * @param returnChanges
139: * @return a project with the new task only if returnChanges is true
140: * @throws Exception
141: */
142: public LiteProject insertBefore(long projectId, int type,
143: long previousId, boolean returnChanges) throws Exception;
144:
145: public List<Long> remove(long projectId, int type, long id,
146: boolean returnRemovedIds) throws Exception;
147:
148: public LiteTask getTask(long projectId, long id) throws Exception;
149:
150: public List<LiteTask> getChildrenTasks(long projectId, long id)
151: throws Exception;
152:
153: public LiteResource getResource(long projectId, long id)
154: throws Exception;
155:
156: public List<LiteResource> getChildrenResource(long projectId,
157: long id) throws Exception;
158:
159: public LiteProject link(long projectId, Long ids[], int type)
160: throws Exception;
161:
162: public LiteProject unlink(long projectId, Long ids[])
163: throws Exception;
164:
165: public LiteProject indent(long projectId, Long ids[])
166: throws Exception;
167:
168: public LiteProject outdent(long projectId, Long ids[])
169: throws Exception;
170:
171: public LiteProject setInterval(long projectId, long id,
172: long newStart, long newEnd, long oldStart, long oldEnd,
173: boolean returnChanges) throws Exception;
174:
175: public LiteProject setCompleted(long projectId, long id,
176: long completed, boolean returnChanges) throws Exception;
177:
178: public void setFieldArray(long projectId, int type,
179: String fieldArrayId) throws Exception;
180:
181: public List<LiteField> getFields(long projectId, int type)
182: throws Exception;
183:
184: public List<String> getFieldArrays(long projectId, int type)
185: throws Exception;
186:
187: public List<LiteField> getFieldArray(int type, String id)
188: throws Exception;
189:
190: public Object zoomTimeScale(long projectId, int amount,
191: float center, boolean returnChange) throws Exception;
192:
193: public Object translateWindow(long projectId, int amount,
194: float center, boolean returnChange) throws Exception;
195:
196: // // methods for finding existing proxy objects
197: // Project project(long id);
198: // Task task(long id);
199: // Resource resource(long id);
200: // Field field(String name);
201: // Field fieldFromId(String id);
202: //
203: // // Factory methods
204: // Project createProject();
205: // Task createTask(Project project);
206: // Resource createResource();
207: //
208: // void saveProject(); // I put these methods here and not in project since they are impl dependent
209: // void saveProjectAs(String newName);
210: // void closeProject();
211: //
212: // void assignResource(Task task, Resource resource);
213: // void link(Task pred,Task succ);
214: //
215: // // also have node versions?
216: // void setText(Field field, Scriptable obj, String textValue);
217: // String getText(Field field, Scriptable obj);
218: // String getValue(Field field, Scriptable obj);
219: //
220: // void select(Collection objects);
221: // // Selection specific methods
222: // void indent();
223: // void outdent();
224: // void fold();
225: // void unfold();
226: // void link(); // selected
227: // void setTextOnSelection(Field field, String textValue); // for things like update task where multiple objects ar changd
228: //
229: // void undo();
230: // void redo();
231: // // cut, copy, paste ?
232:
233: public ReportData getReport(String reportId, String fieldArrayId);
234:
235: }
|