Commit b676a61c authored by Eduardo Santos's avatar Eduardo Santos
Browse files

Minor fix

parent cfa1a133
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ public class ServiceRepoService {

		boolean serviceCharacteristicChanged = false;
		boolean serviceCharacteristicChangedContainsPrimitive = false;
        boolean serviceCharacteristicChangedContainsNSLCM = false;
		boolean serviceCharacteristicChangedContainsNSLCM;
		
		String charChangedForNotes = "";
		List<Characteristic> childCharacteristicsChanged = new ArrayList<>();
@@ -461,6 +461,7 @@ public class ServiceRepoService {
		
		if ( servUpd.getServiceCharacteristic()!=null ) {
			for (Characteristic n : servUpd.getServiceCharacteristic()) {
				serviceCharacteristicChangedContainsNSLCM = false;
				
					if ( service.getServiceCharacteristicByName( n.getName() )!= null ) {
						
@@ -482,6 +483,8 @@ public class ServiceRepoService {
									// Flag to indicate that service characteristic with NSLCM is present
									serviceCharacteristicChangedContainsNSLCM = true;

									System.out.println("ENTROU AQUI");

									// Update the NSLCM Characteristic
									updateNSLCMCharacteristic(service, n);
								}
@@ -706,27 +709,23 @@ public class ServiceRepoService {
        // Retrieve the service characteristic based on the name
        Characteristic NSLCMCharacteristic = service.getServiceCharacteristicByName(n.getName());

        // Retrieve the current value of the characteristic
        Any NSLCMCharacteristicValue = NSLCMCharacteristic.getValue();

        // Retrieve the current value as a string directly from the service characteristic
        String ServiceNSLCMValue = service.getServiceCharacteristicByName(n.getName()).getValue().getValue();
        String NSLCMCharacteristicValue = service.getServiceCharacteristicByName(n.getName()).getValue().getValue();

        // Check if the current service characteristic value is null or explicitly "null" and initialize if needed
        if (ServiceNSLCMValue == null || "null".equals(ServiceNSLCMValue)) {
        if (NSLCMCharacteristicValue == null || "null".equals(NSLCMCharacteristicValue) || NSLCMCharacteristicValue == "") {
            service.getServiceCharacteristicByName(n.getName()).getValue().setValue("[]");
        }

        // Check if the current characteristic value is not null and not explicitly "null"
        if (NSLCMCharacteristicValue.getValue() != null || !"null".equals(NSLCMCharacteristicValue.getValue())) {
            // Convert the current characteristic value to a string
            String NSLCMCharacteristicValueString = NSLCMCharacteristicValue.getValue();
        if (n.getValue().getValue() != null || !"null".equals(n.getValue().getValue())) {
			NSLCMCharacteristicValue = service.getServiceCharacteristicByName(n.getName()).getValue().getValue();

            ArrayList<String> arrayList = null;

            // Deserialize the current value back to an array list
            try {
                arrayList = primitivesObjectMapper.readValue(NSLCMCharacteristicValueString, new TypeReference<ArrayList<String>>() {});
                arrayList = primitivesObjectMapper.readValue(NSLCMCharacteristicValue, new TypeReference<ArrayList<String>>() {});
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }