-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. licenses this file to you 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 org.wso2.carbon.apimgt.impl.lifecycle; | ||
public class CheckListItem implements Comparable { | ||
private String lifeCycleStatus; | ||
private String name; | ||
private String value; | ||
private String order; | ||
private String propertyName; | ||
private String isVisible; | ||
private static final Object HASH_CODE_OBJECT = new Object(); | ||
Check warning on line 26 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L26
|
||
|
||
public String getVisible() { | ||
return this.isVisible; | ||
Check warning on line 29 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L29
|
||
} | ||
|
||
public void setVisible(String visible) { | ||
this.isVisible = visible; | ||
} | ||
Check warning on line 34 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L33-L34
|
||
|
||
public String getPropertyName() { | ||
return this.propertyName; | ||
Check warning on line 37 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L37
|
||
} | ||
|
||
public void setPropertyName(String propertyName) { | ||
this.propertyName = propertyName; | ||
} | ||
Check warning on line 42 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L41-L42
|
||
|
||
public String getLifeCycleStatus() { | ||
return this.lifeCycleStatus; | ||
Check warning on line 45 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L45
|
||
} | ||
|
||
public void setLifeCycleStatus(String lifeCycleStatus) { | ||
this.lifeCycleStatus = lifeCycleStatus; | ||
} | ||
Check warning on line 50 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L49-L50
|
||
|
||
public String getName() { | ||
return this.name; | ||
Check warning on line 53 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L53
|
||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
Check warning on line 58 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L57-L58
|
||
|
||
public String getValue() { | ||
return this.value; | ||
Check warning on line 61 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L61
|
||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
Check warning on line 66 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L65-L66
|
||
|
||
public String getOrder() { | ||
return this.order; | ||
Check warning on line 69 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L69
|
||
} | ||
|
||
public void setOrder(String order) { | ||
this.order = order; | ||
} | ||
Check warning on line 74 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L73-L74
|
||
|
||
public CheckListItem(String lifeCycleStatus, String name, String value, String order) { | ||
this.lifeCycleStatus = lifeCycleStatus; | ||
this.name = name; | ||
this.value = value; | ||
this.order = order; | ||
} | ||
Check warning on line 81 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L76-L81
|
||
|
||
public CheckListItem() { | ||
} | ||
Check warning on line 84 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L83-L84
|
||
|
||
public boolean matchLifeCycleStatus(String status, boolean ignoreCase) { | ||
if (this.lifeCycleStatus != null && status != null) { | ||
return ignoreCase ? this.lifeCycleStatus.equalsIgnoreCase(status) : this.lifeCycleStatus.equals(status); | ||
} else { | ||
return false; | ||
Check warning on line 90 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L90
|
||
} | ||
} | ||
|
||
public boolean matchLifeCycleStatus(String status) { | ||
return this.matchLifeCycleStatus(status, true); | ||
Check warning on line 95 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L95
|
||
} | ||
|
||
public int hashCode() { | ||
int hashCode = HASH_CODE_OBJECT.hashCode(); | ||
Check warning on line 99 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L99
|
||
if (this.order != null) { | ||
hashCode &= this.order.hashCode(); | ||
Check warning on line 101 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L101
|
||
} | ||
|
||
if (this.name != null) { | ||
hashCode &= this.name.hashCode(); | ||
Check warning on line 105 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L105
|
||
} | ||
|
||
if (this.value != null) { | ||
hashCode &= this.value.hashCode(); | ||
Check warning on line 109 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L109
|
||
} | ||
|
||
if (this.lifeCycleStatus != null) { | ||
hashCode &= this.lifeCycleStatus.hashCode(); | ||
Check warning on line 113 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L113
|
||
} | ||
|
||
if (this.propertyName != null) { | ||
hashCode &= this.propertyName.hashCode(); | ||
Check warning on line 117 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L117
|
||
} | ||
|
||
return hashCode; | ||
Check warning on line 120 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L120
|
||
} | ||
|
||
public boolean equals(Object obj) { | ||
if (!(obj instanceof CheckListItem)) { | ||
return false; | ||
Check warning on line 125 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L125
|
||
} else { | ||
CheckListItem item = (CheckListItem)obj; | ||
Check warning on line 127 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L127
|
||
return (this.order != null && this.order.equals(item.order) || this.order == null && item.order == null) && (this.lifeCycleStatus != null && this.lifeCycleStatus.equals(item.lifeCycleStatus) || this.lifeCycleStatus == null && item.lifeCycleStatus == null) && (this.name != null && this.name.equals(item.name) || this.name == null && item.name == null) && (this.value != null && this.value.equals(item.value) || this.value == null && item.value == null) && (this.propertyName != null && this.propertyName.equals(item.propertyName) || this.propertyName == null && item.propertyName == null); | ||
} | ||
} | ||
|
||
public int compareTo(Object anotherItem) { | ||
if (this.equals(anotherItem)) { | ||
return 0; | ||
Check warning on line 134 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L134
|
||
} else { | ||
CheckListItem item = (CheckListItem)anotherItem; | ||
int otherItemOrder = Integer.parseInt(item.getOrder()); | ||
int itemOrder = Integer.parseInt(this.order); | ||
return itemOrder - otherItemOrder; | ||
Check warning on line 139 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java Codecov / codecov/patchcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L136-L139
|
||
} | ||
} | ||
} |