/*
 * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.b2international.snowowl.snomed.datastore.server.request;

import com.b2international.snowowl.core.date.EffectiveTimes;
import com.b2international.snowowl.snomed.core.domain.SnomedReferenceSetMember;
import com.b2international.snowowl.snomed.datastore.index.refset.SnomedRefSetMemberIndexEntry;
import com.b2international.snowowl.snomed.datastore.server.domain.SnomedReferenceSetMemberImpl;
import com.google.common.base.Function;

/**
 * @since 4.5
 */
public class SnomedReferenceSetMemberConverter implements Function<SnomedRefSetMemberIndexEntry, SnomedReferenceSetMember> {

	@Override
	public SnomedReferenceSetMember apply(SnomedRefSetMemberIndexEntry input) {
		final SnomedReferenceSetMemberImpl member = new SnomedReferenceSetMemberImpl();
		member.setId(input.getId());
		member.setEffectiveTime(EffectiveTimes.toDate(input.getEffectiveTimeAsLong()));
		member.setReleased(input.isReleased());
		member.setActive(input.isActive());
		member.setModuleId(input.getModuleId());
		member.setReferencedComponentId(input.getReferencedComponentId());
		member.setReferenceSetId(input.getRefSetIdentifierId());
		return member;
	}

}

@@ -1023,16 +1023,91 @@
 erImpl;%0A
+import com.b2international.snowowl.snomed.snomedrefset.SnomedRefSetMember;%0A
 import c
@@ -1842,10 +1842,517 @@
 er;%0A%09%7D%0A%0A
+%09public SnomedReferenceSetMember apply(SnomedRefSetMember input) %7B%0A%09%09final SnomedReferenceSetMemberImpl member = new SnomedReferenceSetMemberImpl();%0A%09%09member.setId(input.getUuid());%0A%09%09member.setEffectiveTime(input.getEffectiveTime());%0A%09%09member.setReleased(input.isReleased());%0A%09%09member.setActive(input.isActive());%0A%09%09member.setModuleId(input.getModuleId());%0A%09%09member.setReferencedComponentId(input.getReferencedComponentId());%0A%09%09member.setReferenceSetId(input.getRefSetIdentifierId());%0A%09%09return member;%0A%09%7D%0A%0A
 %7D%0A

convert refset member cdo object to representation