public static void checkOut(EPMWorkspace epmWorkSpace, EPMDocument cad) throws Exception { if(CheckInOutTaskLogic.isCheckedOut(cad)){ cad = (EPMDocument) CheckInOutTaskLogic.getWorkingCopy(cad); } else { WTArrayList collector = new WTArrayList(); collector.add(cad); WTValuedMap checkedOutObjects = EPMWorkspaceHelper.manager.checkout(epmWorkSpace, collector); cad = (EPMDocument)((ObjectReference)checkedOutObjects.get(cad)).getObject(); } } public static void checkIn(EPMWorkspace epmWorkSpace, EPMDocument cad) throws Exception { CheckinOption cio = new CheckinOption("checked in by loader"); WTKeyedHashMap wtkeymap = new WTKeyedHashMap(); wtkeymap.put( cad, cio ); EPMWorkspaceHelper.manager.checkin(epmWorkSpace, wtkeymap); } public static void removeFromWS(EPMWorkspace epmWorkSpace, EPMDocument cad) throws Exception { WTArrayList collector = new WTArrayList(); collector.add(cad); EPMWorkspaceHelper.manager.removeFromWorkspace(epmWorkSpace, collector); } public static EPMWorkspace findWorkspace(String name, WTPrincipal owner) throws WTException { QuerySpec select = new QuerySpec(EPMWorkspace.class); select.appendWhere(new SearchCondition(EPMWorkspace.class,EPMWorkspace.NAME, SearchCondition.EQUAL, name), new int[] {0}); select.appendAnd(); select.appendWhere(new SearchCondition(EPMWorkspace.class, EPMWorkspace.PRINCIPAL_REFERENCE +"."+ WTAttributeNameIfc.REF_OBJECT_ID, SearchCondition.EQUAL, PersistenceHelper.getObjectIdentifier(owner).getId()), new int[] {0}); QueryResult workspaces = PersistenceHelper.manager.find((StatementSpec)select); return (EPMWorkspace) (workspaces.hasMoreElements() ? workspaces.nextElement() : null); }