Skip to main content
summaryrefslogtreecommitdiffstats
blob: da19e88cd12bc76625b9878dec8f3f40d977b3fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*******************************************************************************
 * Copyright (c) 2012 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.framework.skynet.core.attribute;

import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.attribute.service.AttributeAdapterService;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;

public abstract class IdentityReferenceAttribute<T extends Id> extends CharacterBackedAttribute<T> {

   @Override
   public T getValue() throws OseeCoreException {
      return convertStringToValue(getAttributeDataProvider().getValueAsString());
   }

   @Override
   public T convertStringToValue(String value) {
      AttributeAdapterService service = getAttributeAdapter();
      T identity = service.adapt(this, new BaseId(Long.valueOf(value)));
      return identity;
   }

   private AttributeAdapterService getAttributeAdapter() throws OseeCoreException {
      return ServiceUtil.getAttributeAdapterService();
   }

}

Back to the top