Fixing code formatting.

revert-dabc3590
shagihan 6 years ago
parent 058cb22358
commit 1aeede731f

@ -1,3 +1,21 @@
/*
* Copyright (c) 2018, WSO2 Inc. (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.mdm.services.android.bean;
import io.swagger.annotations.ApiModel;
@ -19,4 +37,5 @@ public class NotifierFrequency extends AndroidOperation implements Serializable
public void setValue(int value) {
this.value = value;
}
}

@ -20,7 +20,11 @@ package org.wso2.carbon.mdm.services.android.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
@ -125,6 +129,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
for (Device device : deviceList) {
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(),device.getType()));
}
if (entry.getValue() != null) {
NotifierFrequency notifierFrequency = new NotifierFrequency();
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
ProfileOperation operation = new ProfileOperation();
@ -135,6 +140,10 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
AndroidAPIUtils.getDeviceManagementService().addOperation(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
operation, deviceIdList);
} else {
return Response.status(Response.Status.BAD_REQUEST)
.entity("No value specified for notifierFrequency.").build();
}
}
}
@ -143,7 +152,6 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
}
configuration.setConfiguration(configs);
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
//AndroidAPIUtils.getGCMService().resetTenantConfigCache();
} catch (DeviceManagementException e) {
msg = "Error occurred while modifying configuration settings of Android platform";
log.error(msg, e);
@ -154,11 +162,6 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
} catch (NullPointerException e) {
msg = "Error occurred while reading notifierFrequency value.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
} catch (OperationManagementException e) {
msg = "Error occurred while modifying configuration settings of Android platform.";
log.error(msg, e);

@ -1,3 +1,21 @@
/*
* Copyright (c) 2018, WSO2 Inc. (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.mdm.services.android.bean;
import io.swagger.annotations.ApiModel;
@ -19,4 +37,5 @@ public class NotifierFrequency extends AndroidOperation implements Serializable
public void setValue(int value) {
this.value = value;
}
}

@ -21,7 +21,11 @@ package org.wso2.carbon.mdm.services.android.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
@ -126,16 +130,21 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
for (Device device : deviceList) {
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
}
if (entry.getValue() != null) {
NotifierFrequency notifierFrequency = new NotifierFrequency();
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY);
operation.setPayLoad(notifierFrequency.toJSON());
operation.setType(Operation.Type.PROFILE);
operation.setType(Operation.Type.CONFIG);
operation.setEnabled(true);
AndroidAPIUtils.getDeviceManagementService().addOperation(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
operation, deviceIdList);
} else {
return Response.status(Response.Status.BAD_REQUEST)
.entity("No value specified for notifierFrequency.").build();
}
}
}

Loading…
Cancel
Save