com.daon.identityx.rest.model.pojo.RestResource Maven / Gradle / Ivy
/*
* Copyright Daon.
*
* 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.daon.identityx.rest.model.pojo;
import com.daon.identityx.rest.model.def.IRestResource;
public class RestResource implements IRestResource {
private String href;
private String allowedPermissions;
private String id;
public RestResource() {
}
public RestResource(String href) {
this.setHref(href);
}
public RestResource(String href, String allowedPermissions) {
this.setHref(href);
this.allowedPermissions = allowedPermissions;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String getExternalId(String href) {
String id = null;
if (href != null) {
String[] parts = href.split("/");
if (parts.length == 0) {
}
else {
id = parts[parts.length - 1];
}
}
else {
// TODO throw exception or return null and let caller handle?
}
return id;
}
@Override
public String toString() {
if (this.href != null) {
return this.href;
} else {
return super.toString();
}
}
public String getAllowedPermissions() {
return allowedPermissions;
}
public void setAllowedPermissions(String permissions) {
this.allowedPermissions = permissions;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy