001/**
002 * Copyright (c) 2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: tao $'
006 * '$Date: 2010-06-03 16:45:10 -0700 (Thu, 03 Jun 2010) $' 
007 * '$Revision: 24730 $'
008 * 
009 * Permission is hereby granted, without written agreement and without
010 * license or royalty fees, to use, copy, modify, and distribute this
011 * software and its documentation for any purpose, provided that the above
012 * copyright notice and the following two paragraphs appear in all copies
013 * of this software.
014 *
015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
019 * SUCH DAMAGE.
020 *
021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
026 * ENHANCEMENTS, OR MODIFICATIONS.
027 *
028 */
029package org.kepler.workflowscheduler.gui;
030
031/**
032 * Represents a map between a local workflow and a remote copy of the workflow
033 * @author tao
034 *
035 */
036public class LocalRemoteWorkflowMap
037{
038  
039  private String localKarFilePath = null;
040  private String workflowLSID = null;
041  private String workflowName = null;
042  private String remoteKarLSID = null;
043  private String repositoryName = null;
044  
045 
046  
047  /**
048   * Constructor
049   * @param localKarFilePath the file path of the local kar file.
050   * @param workflowLSID the lsid of the workflow. It is same on both local and remote copies.
051   * @param workflowName the name of the workflow. It is same on both local and remote copies.
052   * @param remoteKarLSID the lisd on the remote copy
053   * @param repositoryName the name of the remote repository
054   */
055  public LocalRemoteWorkflowMap(String localKarFilePath, String workflowLSID,
056           String workflowName,String remoteKarLSID, String repositoryName)
057  {
058    this.localKarFilePath = localKarFilePath;
059    this.workflowLSID = workflowLSID;
060    this.workflowName = workflowName;
061    this.remoteKarLSID = remoteKarLSID;
062    this.repositoryName = repositoryName;
063  }
064
065
066
067  public String getLocalKarFilePath()
068  {
069    return localKarFilePath;
070  }
071
072
073
074  public void setLocalKarFilePath(String localKarFilePath)
075  {
076    this.localKarFilePath = localKarFilePath;
077  }
078
079
080
081  public String getWorkflowLSID()
082  {
083    return workflowLSID;
084  }
085
086
087
088  public void setWorkflowLSID(String workflowLSID)
089  {
090    this.workflowLSID = workflowLSID;
091  }
092
093
094
095  public String getWorkflowName()
096  {
097    return workflowName;
098  }
099
100
101
102  public void setWorkflowName(String workflowName)
103  {
104    this.workflowName = workflowName;
105  }
106
107
108
109  public String getRemoteKarLSID()
110  {
111    return remoteKarLSID;
112  }
113
114
115
116  public void setRemoteKarLSID(String remoteKarLSID)
117  {
118    this.remoteKarLSID = remoteKarLSID;
119  }
120
121
122
123  public String getRepositoryName()
124  {
125    return repositoryName;
126  }
127
128
129
130  public void setRepositoryName(String repositoryName)
131  {
132    this.repositoryName = repositoryName;
133  }
134  
135  /**
136   * Test if two maps equal
137   * @param map the compared map
138   * @return true if two maps have the same local kar file path,
139   * workflowLISD, workflow name, remote kar lsid and repository name
140   */
141  public boolean equals(LocalRemoteWorkflowMap map)
142  {
143    boolean equal = false;
144    if(localKarFilePath != null && workflowLSID != null && workflowName != null &&
145                                   remoteKarLSID != null && repositoryName != null)
146    {
147      if(localKarFilePath.equals(map.getLocalKarFilePath()) && workflowLSID.equals(map.getWorkflowLSID()) &&
148          workflowName.equals(map.getWorkflowName()) && remoteKarLSID.equals(map.getRemoteKarLSID()) &&
149          repositoryName.equals(map.getRepositoryName()))
150      {
151        equal = true;
152       }
153    }
154    return equal;
155  }
156}