| 1 | /** |
| 2 | * Copyright 2009 ATG DUST Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * |
| 7 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and limitations under the License. |
| 13 | */ |
| 14 | |
| 15 | package atg.adapter.gsa.xml; |
| 16 | |
| 17 | import java.util.HashSet; |
| 18 | |
| 19 | import atg.epub.project.CreateProject; |
| 20 | import atg.epub.project.ProjectException; |
| 21 | |
| 22 | /** |
| 23 | * |
| 24 | * @author qma |
| 25 | * |
| 26 | * This class is a helper class. It uses to help access the package private class VersioningContext. |
| 27 | * |
| 28 | */ |
| 29 | public class VersioningContextUtil |
| 30 | { |
| 31 | |
| 32 | //------------------------------------- |
| 33 | /** Class version string */ |
| 34 | |
| 35 | public static String CLASS_VERSION = "$Id: //test/UnitTests/base/main/src/Java/atg/adapter/gsa/xml/VersioningContextUtil.java#5 $$Change: 535542 $"; |
| 36 | |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * If supply projectName argument, We will use projectName, projectType and user to create project and get its workspaceId. |
| 41 | * If you set DoCheckin to true, you have to supply comment. |
| 42 | */ |
| 43 | public static VersioningContext versioningContextHelper(String pProjectName, String pProjectType, String pUser, String pWorkspaceId, String pBranchId, String pComment, boolean pDoCheckin) { |
| 44 | |
| 45 | throw new IllegalArgumentException( |
| 46 | "VersioningContextUtil class needs to be updated to support recent publishing changes. See bug 84830."); |
| 47 | /* |
| 48 | VersioningContext versioningContext = new VersioningContext(pProjectName, pProjectType, pUser, pWorkspaceId, pBranchId, pComment, pDoCheckin); |
| 49 | |
| 50 | try { |
| 51 | pWorkspaceId = CreateProject.createProject(pProjectName, pProjectType, pUser); |
| 52 | versioningContext.setWorkspaceId(pWorkspaceId); |
| 53 | } |
| 54 | catch (ProjectException e) { |
| 55 | e.printStackTrace(); |
| 56 | System.out.println("Can not create project with these info: projectName=" + pProjectName + ", projectType=" + pProjectType + ", user=" + pUser +"!"); |
| 57 | } |
| 58 | |
| 59 | */ |
| 60 | |
| 61 | /* |
| 62 | System.out.println("=============pProjectName = " + versioningContext.getProjectName()); |
| 63 | System.out.println("=============pWorkflowName = " + versioningContext.getWorkflowName()); |
| 64 | System.out.println("=============pUser = " + versioningContext.getUser()); |
| 65 | System.out.println("=============pWrokspaceId = " + versioningContext.getWorkspaceId()); |
| 66 | System.out.println("=============pBranchId = " + versioningContext.getBranchId()); |
| 67 | System.out.println("=============pComment = " + versioningContext.getComment()); |
| 68 | System.out.println("=============pDoCheckin = " + versioningContext.isDoCheckin()); |
| 69 | */ |
| 70 | |
| 71 | // return versioningContext; |
| 72 | } |
| 73 | |
| 74 | /* |
| 75 | * If supply workspacdId argument, you must supply branchId. |
| 76 | * If you set DoCheckin to true, you have to supply comment. |
| 77 | */ |
| 78 | public static VersioningContext versioningContextHelper(String pWorkspaceId, String pBranchId, String pComment, boolean pDoCheckin) { |
| 79 | |
| 80 | throw new IllegalArgumentException( |
| 81 | "VersioningContextUtil class needs to be updated to support recent publishing changes. See bug 84830."); |
| 82 | |
| 83 | // VersioningContext versioningContext = new VersioningContext(pWorkspaceId, pBranchId, pComment, pDoCheckin); |
| 84 | |
| 85 | /* |
| 86 | System.out.println("=============pWrokspaceId = " + versioningContext.getWorkspaceId()); |
| 87 | System.out.println("=============pBranchId = " + versioningContext.getBranchId()); |
| 88 | System.out.println("=============pComment = " + versioningContext.getComment()); |
| 89 | System.out.println("=============pDoCheckin = " + versioningContext.isDoCheckin()); |
| 90 | */ |
| 91 | // return versioningContext; |
| 92 | } |
| 93 | |
| 94 | public static VersioningContext createVersioningContext(String pProcessName, String pWorkflowName, |
| 95 | String pUser, String pComment, boolean pCheckin) { |
| 96 | return new VersioningContext(pProcessName, pWorkflowName, pUser,pComment, pCheckin); |
| 97 | } |
| 98 | |
| 99 | public static VersioningContext createVersioningContext(String pWorkspaceName, String pComment, boolean pCheckin) { |
| 100 | return new VersioningContext(pWorkspaceName, pComment, pCheckin); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |