/*
 * 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.internal.id;

import com.b2international.snowowl.core.terminology.ComponentCategory;
import com.b2international.snowowl.snomed.datastore.id.SnomedIdentifierValidator;
import com.b2international.snowowl.snomed.datastore.id.SnomedIdentifiers;

/**
 * @since 4.4
 */
public class SnomedComponentIdentifierValidator implements SnomedIdentifierValidator {

	private ComponentCategory category;

	public SnomedComponentIdentifierValidator(ComponentCategory category) {
		this.category = category;
	}
	
	@Override
	public boolean isValid(String componentId) {
		try {
			SnomedIdentifiers.validate(componentId);
			return category.equals(SnomedIdentifiers.getComponentCategory(componentId));
		} catch (IllegalArgumentException e) {
			return false;
		}
	}
	
	

}

@@ -1239,52 +1239,8 @@
 y %7B%0A
-%09%09%09SnomedIdentifiers.validate(componentId);%0A
 %09%09%09r

remove unnecessary validate method calls