fixing formatting issues

revert-dabc3590
Hasunie 7 years ago
parent 70f971cc26
commit 54e5fad42a

@ -352,12 +352,10 @@ public final class PluginConstants {
private WindowsEnrollmentProperties() {
throw new AssertionError();
}
public static final String DEVICE_NAME = "DeviceName";
public static final String DEVICE_VERSION = "OSVersion";
public static final String DEVICE_ID = "DeviceID";
public static final String IMEI = "MobileEquipmentId";
public static final String TYPE = "DeviceType";
}
}

@ -43,6 +43,7 @@ public class StatusTag {
this.targetReference = targetReference;
this.data = data;
}
public StatusTag(int commandId, int messageReference, int commandReference, String command,
ChallengeTag challengeTag, String targetReference, String data) {
this.commandId = commandId;
@ -142,15 +143,12 @@ public class StatusTag {
status.appendChild(targetReference);
}
if (getChallenge() != null) {
getChallenge().buildChallengeElement(doc, status);
}
if (getData() != null) {
Element data = doc.createElement(Constants.DATA);
data.appendChild(doc.createTextNode(getData()));
status.appendChild(data);
}
}
}

@ -244,10 +244,8 @@ public class OperationHandler {
updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations);
}
}
}
public void updateDeviceInfoStatus(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
List<? extends Operation> pendingDeviceInfoOperations;
try {
@ -669,14 +667,12 @@ public class OperationHandler {
public void checkForDeviceWipe(List<? extends Operation> pendingDeviceInfoOperations
, DeviceIdentifier deviceIdentifier) throws OperationManagementException {
for (Operation operation : pendingDeviceInfoOperations) {
if (PluginConstants.OperationCodes.WIPE_DATA.equals(operation.getCode())) {
operation.setStatus(Operation.Status.COMPLETED);
updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations);
}
}
}
}

@ -161,7 +161,6 @@ public class OperationReply {
}
private SyncmlBody generateStatuses() {
SyncmlBody sourceSyncmlBody = syncmlDocument.getBody();
SyncmlHeader sourceHeader = syncmlDocument.getHeader();
StatusTag headerStatus;
@ -183,7 +182,6 @@ public class OperationReply {
} else {
for (StatusTag sourceStatus : sourceStatuses) {
if (sourceStatus.getChallenge() != null && HEADER_COMMAND_TEXT.equals(sourceStatus.getCommand())) {
headerStatus =
new StatusTag(headerCommandId, sourceHeader.getMsgID(), HEADER_STATUS_ID,
HEADER_COMMAND_TEXT, challengeTag, sourceHeader.getSource().getLocURI(),
@ -239,7 +237,6 @@ public class OperationReply {
private void appendOperations(SyncmlBody syncmlBody) throws PolicyManagementException,
FeatureManagementException, JSONException, SyncmlOperationException {
GetTag getElement = new GetTag();
List<ItemTag> getElements = new ArrayList<>();
List<ExecuteTag> executeElements = new ArrayList<>();

@ -100,7 +100,6 @@ public class EnrollmentServiceImpl implements EnrollmentService {
AdditionalContext additionalContext,
Holder<RequestSecurityTokenResponse> response)
throws WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException {
String headerBinarySecurityToken = null;
String headerTo = null;
String encodedWap;
@ -221,14 +220,12 @@ public class EnrollmentServiceImpl implements EnrollmentService {
String signedCertEncodedString;
X509Certificate signedCertificate;
String provisioningXmlString;
CertificateManagementServiceImpl certMgtServiceImpl = CertificateManagementServiceImpl.getInstance();
Base64 base64Encoder = new Base64();
try {
X509Certificate rootCACertificate = (X509Certificate) certMgtServiceImpl.getCACertificate();
rootCertEncodedString = base64Encoder.encodeAsString(rootCACertificate.getEncoded());
signedCertificate = certMgtServiceImpl.getSignedCertificateFromCSR(binarySecurityToken);
signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded());
@ -313,7 +310,6 @@ public class EnrollmentServiceImpl implements EnrollmentService {
Node pollValue = pollingAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE);
pollValue.setTextContent(pollingFrequency);
provisioningXmlString = convertDocumentToString(document);
} catch (ParserConfigurationException e) {
throw new WAPProvisioningException("Problem occurred while creating configuration request", e);
} catch (CertificateEncodingException e) {

@ -89,20 +89,16 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
(PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) {
if (syncmlHeader.getCredential() != null) {
token = syncmlHeader.getCredential().getData();
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
carbonCtx.setTenantId(cacheToken.getTenanatID(), true);
if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) {
if (modifyEnrollWithMoreDetail(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) {
pendingOperations = operationHandler.getPendingOperations(syncmlDocument);
operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier);
response = operationReply.generateReply(syncmlDocument, pendingOperations);
return Response.status(Response.Status.OK).entity(response).build();
} else {
String msg = "Error occurred in while modify the enrollment.";
log.error(msg);
@ -113,7 +109,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
log.error(msg);
return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build();
}
} else {
return Response.ok().entity(operationReply.generateReply(syncmlDocument, null)).build();
}
@ -121,7 +116,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
if (DeviceUtil.getTokenEntryFromDeviceId(deviceIdentifier.getId()) == null) {
if (syncmlHeader.getCredential() != null) {
token = syncmlHeader.getCredential().getData();
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
@ -193,7 +187,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
boolean status = false;
String user;
SyncmlDocument syncmlDocument;
try {
syncmlDocument = SyncmlParser.parseSyncmlPayload(request);
ReplaceTag replace = syncmlDocument.getBody().getReplace();
@ -218,7 +211,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
if (!existingDevice.getProperties().isEmpty()) {
List<Device.Property> existingProperties = new ArrayList<>();
Device.Property vendorProperty = new Device.Property();
vendorProperty.setName(PluginConstants.SyncML.VENDOR);
vendorProperty.setValue(devMan);

Loading…
Cancel
Save