import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.vendorlicense.VendorLicenseUtil;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
@Table(keyspace = "dox", name = "entitlement_pool")
public class EntitlementPoolEntity implements VersionableEntity {
+
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static final String ENTITY_TYPE = "Entitlement Pool";
@PartitionKey
}
public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
- if(operationalScope != null) {
+ if (operationalScope != null) {
operationalScope.resolveEnum(OperationalScope.class);
}
this.operationalScope = operationalScope;
}
/**
- * Gets version for artifact.
+ * Gets version for artifact.
+ *
* @return version in format suitable for artifact
*/
public String getVersionForArtifact() {
this.limits = limits;
}
- public LimitForXml getSPLimits(){
- if(limits != null){
+ public LimitForXml getSPLimits() {
+ if (limits != null) {
Set<LimitXml> hs = new HashSet<>();
- for(LimitEntity obj : limits){
- if(obj.getType().equals(LimitType.ServiceProvider)){
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.ServiceProvider)) {
LimitXml xmlObj = new LimitXml();
xmlObj.setDescription(obj.getDescription());
xmlObj.setMetric(obj.getMetric());
xmlObj.setValues(obj.getValue());
xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setAggregationFunction(
+ obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
xmlObj.setTime(obj.getTime());
hs.add(xmlObj);
}
return null;
}
- public LimitForXml getVendorLimits(){
- if(limits != null){
+ public LimitForXml getVendorLimits() {
+ if (limits != null) {
Set<LimitXml> hs = new HashSet<>();
- for(LimitEntity obj : limits){
- if(obj.getType().equals(LimitType.Vendor)){
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.Vendor)) {
LimitXml xmlObj = new LimitXml();
xmlObj.setDescription(obj.getDescription());
xmlObj.setMetric(obj.getMetric());
xmlObj.setValues(obj.getValue());
xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setAggregationFunction(
+ obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
xmlObj.setTime(obj.getTime());
hs.add(xmlObj);
}
&& Objects.equals(operationalScope, that.operationalScope)
&& Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups)
&& Objects.equals(startDate, that.startDate)
- && Objects.equals(expiryDate, that.expiryDate);
+ && Objects.equals(expiryDate, that.expiryDate)
+ && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
+ && Objects.equals(version, that.version);
}
@Override
public OperationalScopeForXml getOperationalScopeForArtifact() {
OperationalScopeForXml obj = new OperationalScopeForXml();
if (operationalScope != null) {
- if(operationalScope.getResults().size() > 0) {
+ if (operationalScope.getResults().size() > 0) {
obj.setValue(operationalScope.getResults());
}
}
public String getManufacturerReferenceNumber() {
return manufacturerReferenceNumber;
}
+
+ public String getIsoFormatStartDate() {
+ mdcDataDebugMessage.debugEntryMessage("start date", startDate);
+ String isoFormatStartDate = null;
+ if (!StringUtils.isEmpty(startDate)) {
+ isoFormatStartDate = VendorLicenseUtil.getIsoFormatDate(startDate);
+ mdcDataDebugMessage.debugExitMessage("start date", "iso format start date", startDate,
+ isoFormatStartDate);
+ }
+ return isoFormatStartDate;
+ }
+
+
+ public String getIsoFormatExpiryDate() {
+ mdcDataDebugMessage.debugEntryMessage("expiry date", expiryDate);
+ String isoFormatExpDate = null;
+ if (!StringUtils.isEmpty(expiryDate)) {
+ isoFormatExpDate = VendorLicenseUtil.getIsoFormatDate(expiryDate);
+ mdcDataDebugMessage.debugExitMessage("expiry date", "iso format expiry date", expiryDate,
+ isoFormatExpDate);
+ }
+ return isoFormatExpDate;
+ }
}