/******************************************************************************* * 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.orcs.account.admin.internal; import org.eclipse.osee.account.admin.Account; import org.eclipse.osee.account.admin.AccountPreferences; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.jdk.core.type.BaseIdentity; import org.eclipse.osee.orcs.data.ArtifactReadable; /** * @author Roberto E. Escobar */ public class AccountArtifact extends BaseIdentity implements Account { private static final String NOT_AVAILABLE = "N/A"; private final ArtifactReadable artifact; private final AccountPreferences preferences; public AccountArtifact(String uuid, ArtifactReadable artifact, AccountPreferences preferences) { super(artifact.getGuid()); this.artifact = artifact; this.preferences = preferences; } @Override public long getId() { return artifact.getLocalId(); } @Override public boolean isActive() { return artifact.getSoleAttributeValue(CoreAttributeTypes.Active, false); } @Override public String getName() { return artifact.getSoleAttributeValue(CoreAttributeTypes.Name, NOT_AVAILABLE); } @Override public String getUserName() { return artifact.getSoleAttributeValue(CoreAttributeTypes.UserId, NOT_AVAILABLE); } @Override public String getEmail() { return artifact.getSoleAttributeValue(CoreAttributeTypes.Email, NOT_AVAILABLE); } @Override public AccountPreferences getPreferences() { return preferences; } @Override public String toString() { return "AccountArtifact [artifact=" + artifact + ", preferences=" + preferences + "]"; } }