de.kaiserpfalzEdv.iam.core.role.PermissionDO.java Source code

Java tutorial

Introduction

Here is the source code for de.kaiserpfalzEdv.iam.core.role.PermissionDO.java

Source

/*
 * Copyright (c) 2014 Kaiserpfalz EDV-Service, Roland Lichti
 *
 * 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 de.kaiserpfalzEdv.iam.core.role;

import de.kaiserpfalzEdv.commons.NameableReadable;
import de.kaiserpfalzEdv.iam.core.base.IAMBaseObject;
import de.kaiserpfalzEdv.iam.role.Permission;
import de.kaiserpfalzEdv.iam.role.PermissionWritable;
import org.apache.commons.lang3.builder.EqualsBuilder;

import java.util.UUID;

/**
 * @author klenkes <rlichti@kaiserpfalz-edv.de>
 * @since 2014Q3
 */
public class PermissionDO extends IAMBaseObject implements PermissionWritable {
    private static final long serialVersionUID = -7337069963497264321L;

    @SuppressWarnings({ "UnusedDeclaration", "deprecation" })
    @Deprecated // Only for JPA, JAXB, builders and so on ...
    protected PermissionDO() {
    }

    protected PermissionDO(final UUID tenant, final UUID id, final NameableReadable name) {
        super(tenant, id, name);
    }

    @Override
    public boolean equals(Object other) {
        if (AttachedPermission.class.isAssignableFrom(other.getClass())) {
            Permission that = (Permission) other;
            return new EqualsBuilder().append(getId(), that.getId()).build();

        }

        return super.equals(other);
    }
}