Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-07-18 18:47:02 -0400
committerAngel Avila2017-07-20 21:15:00 -0400
commitdc6793c1759d271751fdad46b6ebda6bf5420e52 (patch)
tree7f9f72be806e7d9889e8918c7327efbccd6752f9
parent131d9c4d3692e4da3a812af08c500a3515c1ce13 (diff)
downloadorg.eclipse.osee-dc6793c1759d271751fdad46b6ebda6bf5420e52.tar.gz
org.eclipse.osee-dc6793c1759d271751fdad46b6ebda6bf5420e52.tar.xz
org.eclipse.osee-dc6793c1759d271751fdad46b6ebda6bf5420e52.zip
refinement: Consolidate AtsUser classes
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigurations.java8
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/JaxAtsObject.java8
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/AtsUser.java (renamed from plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUser.java)89
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUser.java90
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUsers.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsConfigurationsService.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUser.java131
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserServiceClientImpl.java8
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/users/CoreAtsUsersTest.java8
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsCoreUsers.java10
-rw-r--r--plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/notify/WorkItemNotificationProcessorTest.java5
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java4
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsUserServiceServerImpl.java12
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/user/AtsUser.java135
14 files changed, 96 insertions, 422 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigurations.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigurations.java
index 2844bf4b86..6e88ac20ce 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigurations.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/AtsConfigurations.java
@@ -17,7 +17,7 @@ import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.annotate.JsonIgnore;
-import org.eclipse.osee.ats.api.user.JaxAtsUser;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.util.ColorColumns;
import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionStringProvider;
import org.eclipse.osee.ats.api.workdef.WorkDefData;
@@ -33,7 +33,7 @@ public class AtsConfigurations implements IAtsWorkDefinitionStringProvider {
private List<AtsConfiguration> configs = new ArrayList<>();
private AtsViews views = new AtsViews();
private ColorColumns colorColumns = new ColorColumns();
- List<JaxAtsUser> users = new ArrayList<>();
+ List<AtsUser> users = new ArrayList<>();
List<Long> atsAdmins = new ArrayList<>();
Long topActionableItem;
Long topTeamDefinition;
@@ -64,11 +64,11 @@ public class AtsConfigurations implements IAtsWorkDefinitionStringProvider {
this.colorColumns = colorColumns;
}
- public List<JaxAtsUser> getUsers() {
+ public List<AtsUser> getUsers() {
return users;
}
- public void setUsers(List<JaxAtsUser> users) {
+ public void setUsers(List<AtsUser> users) {
this.users = users;
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/JaxAtsObject.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/JaxAtsObject.java
index 3a21d1d42e..1e2536ee50 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/JaxAtsObject.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/config/JaxAtsObject.java
@@ -22,11 +22,11 @@ import org.eclipse.osee.framework.core.data.ArtifactId;
@XmlRootElement
public class JaxAtsObject {
- private String name;
+ protected String name;
@JsonSerialize(using = ToStringSerializer.class)
- private Long uuid;
- private String guid;
- private boolean active;
+ protected Long uuid;
+ protected String guid;
+ protected boolean active;
private String description;
public String getName() {
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUser.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/AtsUser.java
index 7392fda27c..80079949e2 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsUser.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/AtsUser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Boeing.
+ * Copyright (c) 2015 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,36 +8,37 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.core.users;
+package org.eclipse.osee.ats.api.user;
-import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.eclipse.osee.ats.api.config.JaxAtsObject;
+import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.data.UserToken;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.jdk.core.type.NamedIdBase;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Collections;
/**
* @author Donald G. Dunne
*/
-public class AtsUser extends NamedIdBase implements IAtsUser {
+public class AtsUser extends JaxAtsObject implements IAtsUser {
private String userId;
- private final String email;
- private final boolean isActive;
+ private String email;
+ private ArtifactToken storeObject;
+ private IUserArtLoader userArtLoader;
- public AtsUser(UserToken user) {
- this(user.getId(), user.getName(), user.getUserId(), user.getEmail(), user.isActive());
+ public AtsUser() {
+ // for jax-rs instantiation
}
- public AtsUser(Long id, String name, String userId, String email, boolean isActive) {
- super(id, name);
+ public AtsUser(Long id, String name, String userId, String email, boolean active) {
this.userId = userId;
this.email = email;
- this.isActive = isActive;
-
+ this.active = active;
+ this.uuid = id;
+ this.name = name;
}
@Override
@@ -54,6 +55,51 @@ public class AtsUser extends NamedIdBase implements IAtsUser {
return email;
}
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ @Override
+ @JsonIgnore
+ public String toStringWithId() {
+ return String.format("[%s]-[%d]", getName(), getUserId());
+ }
+
+ @Override
+ @JsonIgnore
+ public ArtifactToken getStoreObject() {
+ if (storeObject == null && userArtLoader != null) {
+ storeObject = userArtLoader.loadUser(this);
+ }
+ return storeObject;
+ }
+
+ @Override
+ public void setStoreObject(ArtifactToken artifact) {
+ this.storeObject = artifact;
+ }
+
+ @JsonIgnore
+ public void setUserArtLoader(IUserArtLoader userArtLoader) {
+ this.userArtLoader = userArtLoader;
+ }
+
+ @Override
+ public Long getId() {
+ return getUuid();
+ }
+
+ @Override
+ @JsonIgnore
+ public IArtifactType getArtifactType() {
+ return CoreArtifactTypes.User;
+ }
+
+ @Override
+ public boolean isOfType(ArtifactTypeId... artifactTypes) {
+ return Collections.asHashSet(artifactTypes).contains(getArtifactType());
+ }
+
@Override
public String toString() {
return String.format("User [%s - %s - %s]", getName(), getUserId(), getEmail());
@@ -91,19 +137,4 @@ public class AtsUser extends NamedIdBase implements IAtsUser {
return true;
}
- @Override
- public boolean isActive() {
- return isActive;
- }
-
- @Override
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.User;
- }
-
- @Override
- public boolean isOfType(ArtifactTypeId... artifactTypes) {
- return Collections.asHashSet(artifactTypes).contains(getArtifactType());
- }
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUser.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUser.java
deleted file mode 100644
index 840129d1ac..0000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUser.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.api.user;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.eclipse.osee.ats.api.config.JaxAtsObject;
-import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-
-/**
- * @author Donald G. Dunne
- */
-@XmlRootElement
-public class JaxAtsUser extends JaxAtsObject implements IAtsUser {
-
- private String userId;
- private String email;
- private ArtifactToken storeObject;
- private IUserArtLoader userArtLoader;
-
- @Override
- public String getUserId() {
- return userId;
- }
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- @Override
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- @Override
- public String toStringWithId() {
- return String.format("[%s]-[%d]", getName(), getUserId());
- }
-
- @Override
- @JsonIgnore
- public ArtifactToken getStoreObject() {
- if (storeObject == null && userArtLoader != null) {
- storeObject = userArtLoader.loadUser(this);
- }
- return storeObject;
- }
-
- @Override
- public void setStoreObject(ArtifactToken artifact) {
- this.storeObject = artifact;
- }
-
- @JsonIgnore
- public void setUserArtLoader(IUserArtLoader userArtLoader) {
- this.userArtLoader = userArtLoader;
- }
-
- @Override
- public Long getId() {
- return getUuid();
- }
-
- @Override
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.User;
- }
-
- @Override
- public boolean isOfType(ArtifactTypeId... artifactTypes) {
- return Collections.asHashSet(artifactTypes).contains(getArtifactType());
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUsers.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUsers.java
index 8308c85d1a..62fea5dff4 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUsers.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/user/JaxAtsUsers.java
@@ -18,17 +18,17 @@ import java.util.List;
*/
public class JaxAtsUsers {
- private List<JaxAtsUser> users = new LinkedList<JaxAtsUser>();
+ private List<AtsUser> users = new LinkedList<AtsUser>();
public JaxAtsUsers() {
// for jax-rs
}
- public List<JaxAtsUser> getUsers() {
+ public List<AtsUser> getUsers() {
return users;
}
- public void setUsers(List<JaxAtsUser> users) {
+ public void setUsers(List<AtsUser> users) {
this.users = users;
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsConfigurationsService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsConfigurationsService.java
index a071c7bb5f..105b94fbcf 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsConfigurationsService.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsConfigurationsService.java
@@ -17,7 +17,7 @@ import org.eclipse.osee.ats.api.config.AtsConfigurations;
import org.eclipse.osee.ats.api.config.IAtsConfigurationProvider;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.user.IUserArtLoader;
-import org.eclipse.osee.ats.api.user.JaxAtsUser;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.skynet.core.UserManager;
@@ -53,7 +53,7 @@ public class AtsConfigurationsService implements IAtsConfigurationProvider {
private AtsConfigurations loadConfigurations() {
AtsConfigurations configs = AtsClientService.getConfigEndpoint().get();
for (IAtsUser user : configs.getUsers()) {
- JaxAtsUser jUser = (JaxAtsUser) user;
+ AtsUser jUser = (AtsUser) user;
jUser.setUserArtLoader(userLoader);
}
return configs;
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUser.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUser.java
deleted file mode 100644
index b704be78c3..0000000000
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUser.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.core.client.internal.user;
-
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsUser implements IAtsUser {
-
- private User user;
-
- public AtsUser(User user) {
- this.user = user;
- }
-
- @Override
- public String getName() {
- return user.getName();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 0;
- int userIdHashCode = 0;
- try {
- userIdHashCode = getUserId() == null ? 0 : getUserId().hashCode();
- } catch (OseeCoreException ex) {
- // Do nothing;
- }
- result = prime * result + userIdHashCode;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- try {
- String objUserId = null;
- if (obj instanceof IAtsUser) {
- objUserId = ((IAtsUser) obj).getUserId();
- } else if (obj instanceof User) {
- objUserId = ((User) obj).getUserId();
- } else {
- return false;
- }
- String thisUserId = getUserId();
- if (thisUserId == null) {
- if (objUserId != null) {
- return false;
- }
- } else if (!thisUserId.equals(objUserId)) {
- return false;
- }
- } catch (OseeCoreException ex) {
- return false;
- }
- return true;
- }
-
- @Override
- public String getUserId() throws OseeCoreException {
- return user.getUserId();
- }
-
- @Override
- public String getEmail() throws OseeCoreException {
- return user.getEmail();
- }
-
- @Override
- public boolean isActive() throws OseeCoreException {
- return user.isActive();
- }
-
- @Override
- public String toString() {
- try {
- return getName();
- } catch (Exception ex) {
- return "Exception: " + ex.getLocalizedMessage();
- }
- }
-
- @Override
- public ArtifactToken getStoreObject() {
- return user;
- }
-
- @Override
- public void setStoreObject(ArtifactToken artifact) {
- if (artifact instanceof User) {
- this.user = (User) artifact;
- }
- }
-
- @Override
- public Long getId() {
- return user.getId();
- }
-
- @Override
- public IArtifactType getArtifactType() {
- return user.getArtifactType();
- }
-
- @Override
- public boolean isOfType(ArtifactTypeId... artifactTypes) {
- return user.isOfType(artifactTypes);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserServiceClientImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserServiceClientImpl.java
index 800f9c2150..d39aaa189a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserServiceClientImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserServiceClientImpl.java
@@ -18,8 +18,8 @@ import java.util.List;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.config.IAtsConfigurationProvider;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.JaxAtsUser;
import org.eclipse.osee.ats.core.client.IAtsUserServiceClient;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.users.AbstractAtsUserService;
@@ -167,8 +167,8 @@ public class AtsUserServiceClientImpl extends AbstractAtsUserService implements
return null;
}
- private JaxAtsUser createFromArtifact(Artifact userArt) {
- JaxAtsUser atsUser = new JaxAtsUser();
+ private AtsUser createFromArtifact(Artifact userArt) {
+ AtsUser atsUser = new AtsUser();
atsUser.setName(userArt.getName());
atsUser.setStoreObject(userArt);
atsUser.setUserId(userArt.getSoleAttributeValue(CoreAttributeTypes.UserId, ""));
@@ -210,7 +210,7 @@ public class AtsUserServiceClientImpl extends AbstractAtsUserService implements
public List<IAtsUser> getUsersFromDb() {
List<IAtsUser> users = new ArrayList<>();
for (ArtifactId userArt : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, CoreBranches.COMMON)) {
- JaxAtsUser atsUser = createFromArtifact((Artifact) userArt);
+ AtsUser atsUser = createFromArtifact((Artifact) userArt);
users.add(atsUser);
}
return users;
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/users/CoreAtsUsersTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/users/CoreAtsUsersTest.java
index e3d9fc4453..9f47a7cfa9 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/users/CoreAtsUsersTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/users/CoreAtsUsersTest.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.users;
import java.util.HashMap;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -29,13 +30,6 @@ import org.junit.Test;
public class CoreAtsUsersTest {
@Test
- public void testGetDescription() {
- Assert.assertEquals(SystemUser.OseeSystem.getName(), AtsCoreUsers.SYSTEM_USER.getDescription());
- Assert.assertEquals(SystemUser.Anonymous.getName(), AtsCoreUsers.ANONYMOUS_USER.getDescription());
- Assert.assertEquals(SystemUser.UnAssigned.getName(), AtsCoreUsers.UNASSIGNED_USER.getDescription());
- }
-
- @Test
public void testIsActive() {
AtsCoreUsers.SYSTEM_USER.isActive();
AtsCoreUsers.ANONYMOUS_USER.isActive();
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsCoreUsers.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsCoreUsers.java
index b64fdb001c..19118a935b 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsCoreUsers.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/users/AtsCoreUsers.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.users;
import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.framework.core.enums.SystemUser;
/**
@@ -18,9 +19,12 @@ import org.eclipse.osee.framework.core.enums.SystemUser;
*/
public final class AtsCoreUsers {
- public static final IAtsUser SYSTEM_USER = new AtsUser(SystemUser.OseeSystem);
- public static final IAtsUser ANONYMOUS_USER = new AtsUser(SystemUser.Anonymous);
- public static final IAtsUser UNASSIGNED_USER = new AtsUser(SystemUser.UnAssigned);
+ public static final IAtsUser SYSTEM_USER = new AtsUser(SystemUser.OseeSystem.getId(),
+ SystemUser.OseeSystem.getName(), SystemUser.OseeSystem.getUserId(), SystemUser.OseeSystem.getEmail(), true);
+ public static final IAtsUser ANONYMOUS_USER = new AtsUser(SystemUser.Anonymous.getId(),
+ SystemUser.Anonymous.getName(), SystemUser.Anonymous.getUserId(), SystemUser.Anonymous.getEmail(), true);
+ public static final IAtsUser UNASSIGNED_USER = new AtsUser(SystemUser.UnAssigned.getId(),
+ SystemUser.UnAssigned.getName(), SystemUser.UnAssigned.getUserId(), SystemUser.UnAssigned.getEmail(), true);
private AtsCoreUsers() {
// UtilityClass
diff --git a/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/notify/WorkItemNotificationProcessorTest.java b/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/notify/WorkItemNotificationProcessorTest.java
index 0443f9479b..8b90847a50 100644
--- a/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/notify/WorkItemNotificationProcessorTest.java
+++ b/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/notify/WorkItemNotificationProcessorTest.java
@@ -34,13 +34,13 @@ import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.team.IAtsWorkItemFactory;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.user.IAtsUserService;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
import org.eclipse.osee.ats.api.workdef.IRelationResolver;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
-import org.eclipse.osee.ats.core.users.AtsUser;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.UserToken;
@@ -81,7 +81,8 @@ public class WorkItemNotificationProcessorTest {
// @formatter:on
private IAtsUser setupUser(UserToken userToken) {
- IAtsUser user = new AtsUser(userToken);
+ IAtsUser user = new AtsUser(userToken.getId(), userToken.getName(), userToken.getUserId(),
+ userToken.getEmail(), userToken.isActive());
when(userService.getUserById(userToken.getUserId())).thenReturn(user);
return user;
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
index 547c115923..ca962e8849 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigEndpointImpl.java
@@ -43,8 +43,8 @@ import org.eclipse.osee.ats.api.data.AtsArtifactToken;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.JaxAtsUser;
import org.eclipse.osee.ats.api.workdef.JaxAtsWorkDef;
import org.eclipse.osee.ats.api.workdef.WorkDefData;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
@@ -125,7 +125,7 @@ public final class AtsConfigEndpointImpl implements AtsConfigEndpointApi {
configs.setValidStateNames(update.getValidStateNames());
// load users
for (IAtsUser user : services.getUserService().getUsersFromDb()) {
- configs.getUsers().add((JaxAtsUser) user);
+ configs.getUsers().add((AtsUser) user);
}
// load admins
ArtifactReadable atsAdminArt = orcsApi.getQueryFactory().fromBranch(services.getAtsBranch()).andIds(
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsUserServiceServerImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsUserServiceServerImpl.java
index ce54b0e7ef..3e776db198 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsUserServiceServerImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsUserServiceServerImpl.java
@@ -10,14 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.ats.rest.internal.config;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
+import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.JaxAtsUser;
import org.eclipse.osee.ats.core.users.AbstractAtsUserService;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
@@ -27,6 +25,8 @@ import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
/**
* @author Donald G. Dunne
@@ -72,8 +72,8 @@ public class AtsUserServiceServerImpl extends AbstractAtsUserService {
};
}
- private JaxAtsUser createFromArtifact(ArtifactReadable userArt) {
- JaxAtsUser atsUser = new JaxAtsUser();
+ private AtsUser createFromArtifact(ArtifactReadable userArt) {
+ AtsUser atsUser = new AtsUser();
atsUser.setName(userArt.getName());
atsUser.setStoreObject(userArt);
atsUser.setUserId(userArt.getSoleAttributeAsString(CoreAttributeTypes.UserId, ""));
@@ -94,7 +94,7 @@ public class AtsUserServiceServerImpl extends AbstractAtsUserService {
for (ArtifactId art : orcsApi.getQueryFactory().fromBranch(CoreBranches.COMMON).andIsOfType(
CoreArtifactTypes.User).getResults()) {
ArtifactReadable userArt = (ArtifactReadable) art;
- JaxAtsUser atsUser = createFromArtifact(userArt);
+ AtsUser atsUser = createFromArtifact(userArt);
users.add(atsUser);
}
return users;
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/user/AtsUser.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/user/AtsUser.java
deleted file mode 100644
index 99d824af78..0000000000
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/user/AtsUser.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.rest.internal.user;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.orcs.data.ArtifactReadable;
-
-/**
- * @author Donald G. Dunne
- */
-@XmlRootElement
-public class AtsUser implements IAtsUser {
-
- private ArtifactReadable user;
-
- public AtsUser(ArtifactReadable user) {
- this.user = user;
- }
-
- @Override
- public String getName() {
- return user.getName();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 0;
- int userIdHashCode = 0;
- try {
- userIdHashCode = getUserId() == null ? 0 : getUserId().hashCode();
- } catch (OseeCoreException ex) {
- // Do nothing;
- }
- result = prime * result + userIdHashCode;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- try {
- String objUserId = null;
- if (obj instanceof IAtsUser) {
- objUserId = ((IAtsUser) obj).getUserId();
- } else {
- return false;
- }
- String thisUserId = getUserId();
- if (thisUserId == null) {
- if (objUserId != null) {
- return false;
- }
- } else if (!thisUserId.equals(objUserId)) {
- return false;
- }
- } catch (OseeCoreException ex) {
- return false;
- }
- return true;
- }
-
- @Override
- public String getUserId() throws OseeCoreException {
- return user.getSoleAttributeAsString(CoreAttributeTypes.UserId);
- }
-
- @Override
- public String getEmail() throws OseeCoreException {
- return user.getSoleAttributeAsString(CoreAttributeTypes.Email, "");
- }
-
- @Override
- public boolean isActive() throws OseeCoreException {
- return user.getSoleAttributeValue(CoreAttributeTypes.Active, false);
- }
-
- @Override
- public String toString() {
- try {
- return String.format("%s (%s)", getName(), getUserId());
- } catch (Exception ex) {
- return "Exception: " + ex.getLocalizedMessage();
- }
- }
-
- @Override
- @JsonIgnore
- public ArtifactToken getStoreObject() {
- return user;
- }
-
- @Override
- public void setStoreObject(ArtifactToken artifact) {
- if (artifact instanceof ArtifactReadable) {
- this.user = (ArtifactReadable) artifact;
- }
- }
-
- @Override
- public Long getId() {
- return this.user.getId();
- }
-
- @Override
- public IArtifactType getArtifactType() {
- return user.getArtifactType();
- }
-
- @Override
- public boolean isOfType(ArtifactTypeId... artifactTypes) {
- return user.isOfType(artifactTypes);
- }
-
-} \ No newline at end of file

Back to the top