revert-70aa11f8
hasuniea 8 years ago
commit 1ebf4e2c7c

@ -18,6 +18,7 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.impl; package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import com.google.gson.JsonArray;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
@ -127,8 +128,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
request.setSince(sinceDate); request.setSince(sinceDate);
result = dms.getAllDevices(request); result = dms.getAllDevices(request);
if (result == null || result.getData() == null || result.getData().size() <= 0) { if (result == null || result.getData() == null || result.getData().size() <= 0) {
return Response.status(Response.Status.OK).entity("No device is modified " + return Response.status(Response.Status.OK).entity(new JsonArray()).build();
"after the timestamp provided in 'since' filter").build();
} }
} else { } else {
result = dms.getAllDevices(request); result = dms.getAllDevices(request);

@ -221,14 +221,22 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
RequestValidationUtil.validatePolicyIds(policyIds); RequestValidationUtil.validatePolicyIds(policyIds);
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService(); PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
boolean policyDeleted = true; boolean policyDeleted = true;
String invalidPolicyIds = "";
try { try {
PolicyAdministratorPoint pap = policyManagementService.getPAP(); PolicyAdministratorPoint pap = policyManagementService.getPAP();
for (int i : policyIds) { for (int i : policyIds) {
Policy policy = pap.getPolicy(i); Policy policy = pap.getPolicy(i);
if (policy == null || !pap.deletePolicy(policy)) { if (policy == null) {
invalidPolicyIds += i + ",";
policyDeleted = false; policyDeleted = false;
} }
} }
if(policyDeleted) {
for(int i : policyIds) {
Policy policy = pap.getPolicy(i);
pap.deletePolicy(policy);
}
}
} catch (PolicyManagementException e) { } catch (PolicyManagementException e) {
String msg = "ErrorResponse occurred while removing policies"; String msg = "ErrorResponse occurred while removing policies";
log.error(msg, e); log.error(msg, e);
@ -239,8 +247,10 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
return Response.status(Response.Status.OK).entity("Policies have been successfully deleted").build(); return Response.status(Response.Status.OK).entity("Policies have been successfully deleted").build();
} else { } else {
//TODO:Check of this logic is correct //TODO:Check of this logic is correct
return Response.status(Response.Status.NOT_FOUND).entity( String ModifiedInvalidPolicyIds = invalidPolicyIds.substring(0, invalidPolicyIds.length()-1);
new ErrorResponse.ErrorResponseBuilder().setMessage("Policy doesn't exist").build()).build(); return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Policies with the policy ID " +
ModifiedInvalidPolicyIds + " doesn't exist").build()).build();
} }
} }

@ -416,11 +416,13 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
boolean isOwnershipProvided = false; boolean isOwnershipProvided = false;
String status = request.getStatus(); String status = request.getStatus();
boolean isStatusProvided = false; boolean isStatusProvided = false;
Date since = request.getSince();
boolean isSinceProvided = false;
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID, d.NAME, d.DEVICE_IDENTIFICATION, " + String sql = "SELECT COUNT(d1.ID) AS DEVICE_COUNT FROM DM_ENROLMENT e, (SELECT d.ID, d.NAME, d.DEVICE_IDENTIFICATION, " +
"t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID " + "t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt WHERE DEVICE_TYPE_ID = t.ID " +
"AND d.TENANT_ID = ?"; "AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID";
if (deviceType != null && !deviceType.isEmpty()) { if (deviceType != null && !deviceType.isEmpty()) {
sql = sql + " AND t.NAME = ?"; sql = sql + " AND t.NAME = ?";
@ -432,6 +434,12 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
isDeviceNameProvided = true; isDeviceNameProvided = true;
} }
//Add query for last updated timestamp
if (since != null) {
sql = sql + " AND dt.UPDATE_TIMESTAMP > ?";
isSinceProvided = true;
}
sql = sql + ") d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?"; sql = sql + ") d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?";
if (ownership != null && !ownership.isEmpty()) { if (ownership != null && !ownership.isEmpty()) {
@ -458,6 +466,9 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
if (isDeviceNameProvided) { if (isDeviceNameProvided) {
stmt.setString(paramIdx++, request.getDeviceName() + "%"); stmt.setString(paramIdx++, request.getDeviceName() + "%");
} }
if (isSinceProvided) {
stmt.setLong(paramIdx++, since.getTime());
}
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {
stmt.setString(paramIdx++, request.getOwnership()); stmt.setString(paramIdx++, request.getOwnership());

@ -59,8 +59,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
"d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " + "d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " +
"e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, " + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, " +
"d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t " + "d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?"; "FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " +
"WHERE DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID";
//Add the query for device-type //Add the query for device-type
if (deviceType != null && !deviceType.isEmpty()) { if (deviceType != null && !deviceType.isEmpty()) {
@ -75,7 +76,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
//Add query for last updated timestamp //Add query for last updated timestamp
if (since != null) { if (since != null) {
sql = sql + " AND d.LAST_UPDATED_TIMESTAMP > ?"; sql = sql + " AND dt.UPDATE_TIMESTAMP > ?";
isSinceProvided = true; isSinceProvided = true;
} }
@ -109,7 +110,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
stmt.setString(paramIdx++, request.getDeviceName() + "%"); stmt.setString(paramIdx++, request.getDeviceName() + "%");
} }
if (isSinceProvided) { if (isSinceProvided) {
stmt.setTimestamp(paramIdx++, new Timestamp(since.getTime())); stmt.setLong(paramIdx++, since.getTime());
} }
stmt.setInt(paramIdx++, tenantId); stmt.setInt(paramIdx++, tenantId);
if (isOwnershipProvided) { if (isOwnershipProvided) {

@ -102,7 +102,7 @@ public class OperationManagerImpl implements OperationManager {
DeviceIDHolder deviceIDHolder = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds); DeviceIDHolder deviceIDHolder = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds);
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList(); List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
if (validDeviceIds.size() > 0) { if (validDeviceIds.size() > 0) {
List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds); List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, validDeviceIds);
if (authorizedDeviceList.size() <= 0) { if (authorizedDeviceList.size() <= 0) {
log.info("User : " + getUser() + " is not authorized to perform operations on given device-list."); log.info("User : " + getUser() + " is not authorized to perform operations on given device-list.");
return null; return null;
@ -123,7 +123,7 @@ public class OperationManagerImpl implements OperationManager {
//TODO have to create a sql to load device details from deviceDAO using single query. //TODO have to create a sql to load device details from deviceDAO using single query.
String operationCode = operationDto.getCode(); String operationCode = operationDto.getCode();
for (DeviceIdentifier deviceId : deviceIds) { for (DeviceIdentifier deviceId : authorizedDeviceList) {
Device device = getDevice(deviceId); Device device = getDevice(deviceId);
enrolmentId = device.getEnrolmentInfo().getId(); enrolmentId = device.getEnrolmentInfo().getId();
//Do not repeat the task operations //Do not repeat the task operations

@ -420,7 +420,8 @@ public class GenericOperationDAOImpl implements OperationDAO {
"ON feom.OPERATION_ID = o.ID LEFT OUTER JOIN (SELECT ID, ENROLMENT_ID, OPERATION_ID, " + "ON feom.OPERATION_ID = o.ID LEFT OUTER JOIN (SELECT ID, ENROLMENT_ID, OPERATION_ID, " +
"OPERATION_RESPONSE, MAX(RECEIVED_TIMESTAMP) LATEST_RECEIVED_TIMESTAMP " + "OPERATION_RESPONSE, MAX(RECEIVED_TIMESTAMP) LATEST_RECEIVED_TIMESTAMP " +
"FROM DM_DEVICE_OPERATION_RESPONSE GROUP BY ENROLMENT_ID , OPERATION_ID) orsp " + "FROM DM_DEVICE_OPERATION_RESPONSE GROUP BY ENROLMENT_ID , OPERATION_ID) orsp " +
"ON o.ID = orsp.OPERATION_ID AND feom.ENROLMENT_ID = orsp.ENROLMENT_ID GROUP BY feom.ENROLMENT_ID"; "ON o.ID = orsp.OPERATION_ID AND feom.ENROLMENT_ID = orsp.ENROLMENT_ID GROUP BY feom.ENROLMENT_ID, " +
"feom.OPERATION_ID";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);

@ -58,8 +58,10 @@ under the License. --}}
<!-- page-content-wrapper --> <!-- page-content-wrapper -->
<div class="page-content-wrapper"> <div class="page-content-wrapper">
{{defineZone "contentTitle"}} {{defineZone "contentTitle"}}
<div class="container-fluid body-wrapper"> <div class="container-fluid ">
{{defineZone "content"}} <div class="body-wrapper">
{{defineZone "content"}}
</div>
</div> </div>
</div> </div>
<!-- /page-content-wrapper --> <!-- /page-content-wrapper -->

@ -19,38 +19,40 @@
{{unit "cdmf.unit.ui.title" pageTitle="Login"}} {{unit "cdmf.unit.ui.title" pageTitle="Login"}}
{{#zone "content"}} {{#zone "content"}}
<div class="container col-xs-12 col-sm-6 col-md-6 col-lg-3 col-centered wr-content wr-login col-centered"> <div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 col-sm-offset-3 col-md-offset-3 col-lg-offset-4">
<p class="page-sub-title">Login</p> <p class="page-sub-title">Login</p>
<hr /> <hr />
{{#if message}} {{#if message}}
<div class="alert alert-danger" style="padding-right: 15px;"> <div class="alert alert-danger" style="padding-right: 15px;">
<i class="icon fw fw-warning"></i> {{message}}! <i class="icon fw fw-warning"></i> {{message}}!
</div>
{{/if}}
<div class="panel-body">
<form id="signInForm" method="POST" action="{{@app.context}}/uuf/login">
<div class="form-group">
<label for="username">Username *</label>
<input type="text" name="username" class="form-control" placeholder="Enter your username"
autofocus="autofocus" required="required" />
</div>
<div class="form-group">
<label for="password">Password *</label>
<input type="password" name="password" class="form-control" placeholder="Enter your password"
required="required" />
</div> </div>
{{#if referer}} {{/if}}
<input type="hidden" name="referer" value="{{referer}}" />
{{/if}} <div class="panel-body">
<div class="wr-input-control wr-btn-grp"> <form id="signInForm" method="POST" action="{{@app.context}}/uuf/login">
<button class="wr-btn btn-download-agent"> <div class="form-group">
Login <label for="username">Username *</label>
</button> <input type="text" name="username" class="form-control" placeholder="Enter your username"
{{defineZone "signInForm-below" scope="protected"}} autofocus="autofocus" required="required" />
</div> </div>
</form> <div class="form-group">
<label for="password">Password *</label>
<input type="password" name="password" class="form-control" placeholder="Enter your password"
required="required" />
</div>
{{#if referer}}
<input type="hidden" name="referer" value="{{referer}}" />
{{/if}}
<div class="wr-input-control wr-btn-grp">
<button class="wr-btn btn-download-agent">
Login
</button>
{{defineZone "signInForm-below" scope="protected"}}
</div>
</form>
</div>
</div> </div>
</div> </div>
{{/zone}} {{/zone}}

@ -17,7 +17,7 @@
}} }}
{{#zone "navMenu-icon"}} {{#zone "navMenu-icon"}}
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-tiles fw-stack-1x toggle-icon-up"></i> <i class="fw fw-menu fw-stack-1x toggle-icon-down"></i>
</span> </span>
{{/zone}} {{/zone}}
@ -105,8 +105,7 @@
data-offset-top="80"> data-offset-top="80">
<ul class="sidebar-messages"> <ul class="sidebar-messages">
</ul> </ul>
<h4 class="text-center"><a href="{{appContext}}notification-listing" class="text-center">Show all notifications</a> <div class="text-center"><a href="{{appContext}}notification-listing" class="btn btn-primary">Show all notifications</a></div>
</h4>
</div> </div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -25,6 +25,7 @@
font-weight: 100; font-weight: 100;
} }
.wr-input-control .cus-col-25 { .wr-input-control .cus-col-25 {
float: left; float: left;
width: 25%; width: 25%;

@ -734,10 +734,6 @@ header .brand h1 {
text-transform: uppercase; text-transform: uppercase;
} }
header .auth {
margin: 0 -15px;
}
header .dropdown { header .dropdown {
display: inline-block; display: inline-block;
color: #ffffff; color: #ffffff;
@ -859,7 +855,7 @@ header .dropdown[aria-expanded=true], header .dropdown:hover {
line-height: 50px; line-height: 50px;
text-transform: uppercase; text-transform: uppercase;
background: #010F1F; background: #010F1F;
height: 50px; height: 40px;
font-size: 14px; font-size: 14px;
} }
@ -3606,7 +3602,6 @@ a.cu-btn, a.cu-btn-inner {
font-weight:400; font-weight:400;
display: inline-block; display: inline-block;
text-transform: uppercase; text-transform: uppercase;
height: 53px;
padding: 13px 10px; padding: 13px 10px;
} }
@ -5051,6 +5046,7 @@ a.wr-side-panel-toggle-btn.selected {
height: 100%; height: 100%;
background: #ffffff; background: #ffffff;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
margin-bottom:40px;
} }
.wr-advance-operations .row:first-child { .wr-advance-operations .row:first-child {

@ -1,4 +1,5 @@
{ {
"version": "1.0.0", "version": "1.0.0",
"extends": "uuf.unit.theme" "extends": "uuf.unit.theme",
"enabled": false
} }

@ -46,8 +46,10 @@
<!-- page-content-wrapper --> <!-- page-content-wrapper -->
<div class="page-content-wrapper"> <div class="page-content-wrapper">
{{defineZone "contentTitle"}} {{defineZone "contentTitle"}}
<div class="container-fluid body-wrapper"> <div class="container-fluid ">
{{defineZone "content"}} <div class="body-wrapper">
{{defineZone "content"}}
</div>
</div> </div>
</div> </div>
<!-- /page-content-wrapper --> <!-- /page-content-wrapper -->

@ -35,8 +35,10 @@
<!-- page-content-wrapper --> <!-- page-content-wrapper -->
<div class="page-content-wrapper"> <div class="page-content-wrapper">
<div class="container-fluid body-wrapper"> <div class="container-fluid ">
{{defineZone "content"}} <div class="body-wrapper">
{{defineZone "content"}}
</div>
</div> </div>
</div> </div>
<!-- /page-content-wrapper --> <!-- /page-content-wrapper -->

@ -16,22 +16,29 @@
under the License. under the License.
}} }}
{{#zone "userMenu"}} {{#zone "userMenu"}}
<a href="#" class="dropdown" data-toggle="dropdown"> <ul class="nav navbar-right float-remove-xs text-center-xs">
<span class="hidden-xs add-padding-left-3x"> <li class="visible-inline-block">
{{@user.username}}<span class="caret"></span> <a href="#" class="dropdown" data-toggle="dropdown">
</span> <span class="icon fw-stack fw-lg">
<span class="icon fw-stack fw-lg"><i class="fw fw-user fw-stack-1x"></i></span> <i class="fw fw-circle fw-stack-2x"></i>
</a> <i class="fw fw-user fw-stack-1x fw-inverse"></i>
<ul class="dropdown-menu float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown" </span>
role="menu"> <span class="hidden-xs add-padding-left-1x">
<li class="dropdown-header visible-xs"> {{@user.username}}<span class="caret"></span>
{{@user.username}}<span class="caret"></span> </span>
</a>
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
<li class="dropdown-header visible-xs">
{{@user.username}}<span class="caret"></span>
</li>
<li class="divider visible-xs"></li>
{{#defineZone "userMenu-items"}}
<li>
<a href="{{@app.context}}/signout">Sign Out</a>
</li>
{{/defineZone}}
</ul>
</li> </li>
<li class="divider visible-xs"></li>
{{#defineZone "userMenu-items"}}
<li>
<a href="{{@app.context}}/signout">Sign Out</a>
</li>
{{/defineZone}}
</ul> </ul>
{{/zone}} {{/zone}}

@ -622,10 +622,6 @@ header .brand {
} }
} }
header .auth {
margin: 0 -15px;
}
header .dropdown { header .dropdown {
display: inline-block; display: inline-block;
color: @base-light-color; color: @base-light-color;

@ -26,6 +26,7 @@
{{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}} {{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}}
<!-- Theme LESS --> <!-- Theme LESS -->
{{~css "less/theme.less" combine=false}} {{~css "less/theme.less" combine=false}}
{{~css "css/theme-wso2.css"}}
{{/zone}} {{/zone}}
{{~#zone "topJs"}} {{~#zone "topJs"}}

Loading…
Cancel
Save