Added license headers with changes

4.x.x
harshanL 10 years ago
parent b7ca60d802
commit 207a51a269

@ -1,18 +1,19 @@
/**
* Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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
* 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.
* 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.device.mgt.mobile;
import org.wso2.carbon.device.mgt.common.*;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.DeviceOperation;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.Feature;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.FeatureProperty;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.Operation;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.OperationProperty;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;
@ -40,9 +56,9 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, deviceOperation.getDeviceId());
stmt.setInt(2, deviceOperation.getOperationId());
stmt.setInt(3, deviceOperation.getSentDate());
stmt.setInt(4, deviceOperation.getReceivedDate());
stmt.setLong(2, deviceOperation.getOperationId());
stmt.setLong(3, deviceOperation.getSentDate());
stmt.setLong(4, deviceOperation.getReceivedDate());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
@ -71,8 +87,8 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
String updateDBQuery =
"UPDATE MBL_DEVICE_OPERATION SET SENT_DATE = ?, RECEIVED_DATE = ? WHERE DEVICE_ID = ? and OPERATION_ID=?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setInt(1, deviceOperation.getSentDate());
stmt.setInt(2, deviceOperation.getReceivedDate());
stmt.setLong(1, deviceOperation.getSentDate());
stmt.setLong(2, deviceOperation.getReceivedDate());
stmt.setString(3, deviceOperation.getDeviceId());
stmt.setInt(4, deviceOperation.getOperationId());
int rows = stmt.executeUpdate();

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;
@ -38,7 +54,7 @@ public class OperationDAOImpl implements OperationDAO {
stmt = conn.prepareStatement(createDBQuery, new String[] { "OPERATION_ID" });
stmt.setString(1, operation.getFeatureCode());
stmt.setInt(2, operation.getCreatedDate());
stmt.setLong(2, operation.getCreatedDate());
int rows = stmt.executeUpdate();
if (rows > 0) {
ResultSet rs = stmt.getGeneratedKeys();
@ -69,7 +85,7 @@ public class OperationDAOImpl implements OperationDAO {
"UPDATE MBL_OPERATION SET FEATURE_CODE = ?, CREATED_DATE = ? WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, operation.getFeatureCode());
stmt.setInt(2, operation.getCreatedDate());
stmt.setLong(2, operation.getCreatedDate());
stmt.setInt(3, operation.getOperationId());
int rows = stmt.executeUpdate();
if (rows > 0) {

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;

@ -1,13 +1,30 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of Operations.
*/
public class DeviceOperation {
String deviceId;
int operationId;
int sentDate;
int receivedDate;
private String deviceId;
private int operationId;
private long sentDate;
private long receivedDate;
public String getDeviceId() {
return deviceId;
@ -25,19 +42,19 @@ public class DeviceOperation {
this.operationId = operationId;
}
public int getSentDate() {
public long getSentDate() {
return sentDate;
}
public void setSentDate(int sentDate) {
public void setSentDate(long sentDate) {
this.sentDate = sentDate;
}
public int getReceivedDate() {
public long getReceivedDate() {
return receivedDate;
}
public void setReceivedDate(int receivedDate) {
public void setReceivedDate(long receivedDate) {
this.receivedDate = receivedDate;
}

@ -1,3 +1,19 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dto;
import java.io.Serializable;
@ -6,10 +22,11 @@ import java.io.Serializable;
* DTO of features.
*/
public class Feature implements Serializable {
int id;
String code;
String name;
String description;
private int id;
private String code;
private String name;
private String description;
public int getId() {
return id;

@ -1,12 +1,29 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of feature property. Represents a property of a feature.
*/
public class FeatureProperty {
int propertyId;
String property;
String featureID;
private int propertyId;
private String property;
private String featureID;
public String getFeatureID() {
return featureID;

@ -1,12 +1,32 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dto;
import java.util.List;
/**
* DTO of operation.
*/
public class Operation {
int operationId;
String featureCode;
int createdDate;
private int operationId;
private String featureCode;
private long createdDate;
private List<OperationProperty> properties;
public int getOperationId() {
return operationId;
@ -16,6 +36,14 @@ public class Operation {
this.operationId = operationId;
}
public List<OperationProperty> getProperties() {
return properties;
}
public void setProperties(List<OperationProperty> properties) {
this.properties = properties;
}
public String getFeatureCode() {
return featureCode;
}
@ -24,13 +52,11 @@ public class Operation {
this.featureCode = featureCode;
}
public int getCreatedDate() {
public long getCreatedDate() {
return createdDate;
}
public void setCreatedDate(int createdDate) {
public void setCreatedDate(long createdDate) {
this.createdDate = createdDate;
}
}

@ -1,13 +1,30 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of operation property.
*/
public class OperationProperty {
int operationPropertyId;
int getOperationId;
int propertyId;
String value;
private int operationPropertyId;
private int operationId;
private int propertyId;
private String value;
public String getValue() {
return value;
@ -26,11 +43,11 @@ public class OperationProperty {
}
public int getOperationId() {
return getOperationId;
return operationId;
}
public void setOperationId(int getOperationId) {
this.getOperationId = getOperationId;
public void setOperationId(int operationId) {
this.operationId = operationId;
}
public int getPropertyId() {

@ -1,5 +1,5 @@
/**
* Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -15,18 +15,40 @@
*/
package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Operation;
import org.wso2.carbon.device.mgt.common.OperationManagementException;
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.DeviceOperation;
import org.wso2.carbon.device.mgt.mobile.dto.OperationProperty;
import java.util.List;
public class AndroidMobileOperationManager extends AbstractMobileOperationManager {
private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class);
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
try {
MobileDeviceManagementDAOFactory.getOperationDAO().addOperation(
new org.wso2.carbon.device.mgt.mobile.dto.Operation());
MobileDeviceManagementDAOFactory.geOperationPropertyDAO()
.addOperationProperty(new OperationProperty());
MobileDeviceManagementDAOFactory.getDeviceOperationDAO()
.addDeviceOperation(new DeviceOperation());
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the enrollment of the Android device : " +
devices.get(0).getId();
log.error(msg, e);
throw new OperationManagementException(msg, e);
}
return false;
}

@ -22,12 +22,13 @@ import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.dto.Operation;
import org.wso2.carbon.device.mgt.mobile.dto.OperationProperty;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
* Provides utility methods required by the mobile device management bundle.
@ -112,4 +113,16 @@ public class MobileDeviceManagementUtil {
}
return device;
}
public static Operation convertToOperation(org.wso2.carbon.device.mgt.common.Operation operation){
Operation mobileOperation = new Operation();
List<OperationProperty> properties = new LinkedList<OperationProperty>();
mobileOperation.setFeatureCode(operation.getCode());
mobileOperation.setCreatedDate(new Date().getTime());
Properties operationProperties = operation.getProperties();
for(String key : operationProperties.stringPropertyNames()) {
String value = operationProperties.getProperty(key);
}
return mobileOperation;
}
}

Loading…
Cancel
Save