It's all about the answers!

Ask a question

Custom IValidator Plugin -> ERROR com.ibm.team.workitem.common - Validator not found


0
1
Alicia Loh (323) | asked Apr 30 '13, 5:50 a.m.
 I just deployed a custom plugin to check for current user and owner to be equal:

package allowOnlyCurrentUserSaveWorkItem;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.common.IContributor;
import com.ibm.team.repository.common.IContributorHandle;
import com.ibm.team.workitem.common.IWorkItemCommon;
import com.ibm.team.workitem.common.internal.attributeValueProviders.AttributeValueProviderDescriptor;
import com.ibm.team.workitem.common.internal.attributeValueProviders.AttributeValueProviderRegistry;
import com.ibm.team.workitem.common.internal.attributeValueProviders.IConfiguration;
import com.ibm.team.workitem.common.internal.attributeValueProviders.IValidator;
import com.ibm.team.workitem.common.model.IAttribute;
import com.ibm.team.workitem.common.model.IWorkItem;

public class allowOnlyCurrentUserSaveWorkItemValidator implements IValidator {
public IStatus validate(IAttribute attribute, IWorkItem workItem, IWorkItemCommon workItemCommon, 
            IConfiguration configuration, IProgressMonitor monitor) throws TeamRepositoryException {

IContributorHandle owner = workItem.getOwner();
ITeamRepository teamRepository = (ITeamRepository)owner.getOrigin();
IContributor currentUser = teamRepository.loggedInContributor();
String currentUserID = currentUser.toString();
String ownerID = owner.toString();

AttributeValueProviderDescriptor descriptor = AttributeValueProviderRegistry.getInstance().getProviderDescriptor(configuration);

if (ownerID == currentUserID)
            return new Status(IStatus.OK, descriptor.getOriginatingPluginId(), "OK");
        else 
            return new Status(IStatus.ERROR, descriptor.getOriginatingPluginId(), "Only the owner of this work item is allowed to modify it.");

}
}
		

I added this validator to the owner attribute and added a pre-condition to do attribute validation when saving work item. However, I get this error in ccm.log whenever I save a workitem:

ERROR com.ibm.team.workitem.common                        - Validator not found

Any idea what could cause this error? Thank you.

One answer



permanent link
Alicia Loh (323) | answered Apr 30 '13, 6:03 a.m.
 I have these errors when checking the provision status of the plugins:

CRJAZ0300I Installing the feature "AllowOnlyCurrentUserSaveWorkItemValidatorProject_1.0.0.201304301628".
CRJAZ0275I The bundle "allowOnlyCurrentUserSaveWorkItem" is already installed.
....
CRJZS0383W Failed to resolve the bundle "allowOnlyCurrentUserSaveWorkItem".
......
CRJAZ0295I A feature with the id "AllowOnlyCurrentUserSaveWorkItemValidatorProject" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.enterprise.server.feature" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.jazz.foundation.server.jfs.feature" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.rtc.update.site.content.rtc.feature" is already installed.
CRJAZ0295I A feature with the id "AllowOnlyCurrentUserSaveWorkItemValidatorProject" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.enterprise.server.feature" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.jazz.foundation.server.jfs.feature" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.rtc.update.site.content.rtc.feature" is already installed.
CRJAZ0295I A feature with the id "AllowOnlyCurrentUserSaveWorkItemValidatorProject" is already installed.
CRJAZ0295I A feature with the id "com.ibm.team.enterprise.server.feature" is already installed.

Your answer


Register or to post your answer.