
rapture.kernel.FieldsApiImplWrapper Maven / Gradle / Ivy
/**
* The MIT License (MIT)
*
* Copyright (C) 2011-2016 Incapture Technologies LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* This is an autogenerated file. You should not edit this file as any changes
* will be overwritten.
*/
package rapture.kernel;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Map;
import rapture.common.api.FieldsApi;
import rapture.common.CallingContext;
import rapture.common.RaptureEntitlementsContext;
import rapture.common.hooks.CallName;
import rapture.common.model.BasePayload;
import rapture.common.EntitlementSet;
import rapture.kernel.context.ContextValidator;
import rapture.common.RaptureField;
import rapture.common.RaptureFolderInfo;
import rapture.common.shared.fields.ListFieldsByUriPrefixPayload;
import rapture.common.shared.fields.GetFieldPayload;
import rapture.common.shared.fields.PutFieldPayload;
import rapture.common.shared.fields.FieldExistsPayload;
import rapture.common.shared.fields.DeleteFieldPayload;
import rapture.common.shared.fields.GetDocumentFieldsPayload;
import rapture.common.shared.fields.PutDocumentAndGetDocumentFieldsPayload;
/**
* This class is a wrapper around the class {@link FieldsApiImpl}. This is an auto-generated class that gives us the ability to add hooks such as entitlmeent
* checks before each function call in the implementation. Since we always want to call these hooks, an instance of this class should be used
* (in {@link Kernel}) instead of using the implementation directly.
* implementation directly.
*
*/
@SuppressWarnings("all")
public class FieldsApiImplWrapper implements FieldsApi, KernelApi {
private static final Logger log = Logger.getLogger(FieldsApiImplWrapper.class);
private FieldsApiImpl apiImpl;
public FieldsApiImplWrapper(Kernel kernel) {
apiImpl = new FieldsApiImpl(kernel);
}
/**
* Returns the underlying implementation object. This should be used when a call is deliberately bypassing entitlement checks.
* @return {@link Fields}
*/
public FieldsApiImpl getTrusted() {
return apiImpl;
}
@Override
public void start() {
apiImpl.start();
}
/**
*
*/
@Override
public Map listFieldsByUriPrefix(CallingContext context, String authority, int depth) {
long functionStartTime = System.currentTimeMillis();
ListFieldsByUriPrefixPayload requestObj = new ListFieldsByUriPrefixPayload();
requestObj.setContext(context);
requestObj.setAuthority(authority);
requestObj.setDepth(depth);
ContextValidator.validateContext(context, EntitlementSet.Fields_listFieldsByUriPrefix, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_listFieldsByUriPrefix);
Map returnValue = apiImpl.listFieldsByUriPrefix(context, authority, depth); Kernel.getApiHooksService().post(context, CallName.Fields_listFieldsByUriPrefix);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.listFieldsByUriPrefix.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.listFieldsByUriPrefix.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public RaptureField getField(CallingContext context, String fieldUri) {
long functionStartTime = System.currentTimeMillis();
GetFieldPayload requestObj = new GetFieldPayload();
requestObj.setContext(context);
requestObj.setFieldUri(fieldUri);
ContextValidator.validateContext(context, EntitlementSet.Fields_getField, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_getField);
RaptureField returnValue = apiImpl.getField(context, fieldUri); Kernel.getApiHooksService().post(context, CallName.Fields_getField);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.getField.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.getField.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void putField(CallingContext context, RaptureField field) {
long functionStartTime = System.currentTimeMillis();
PutFieldPayload requestObj = new PutFieldPayload();
requestObj.setContext(context);
requestObj.setField(field);
ContextValidator.validateContext(context, EntitlementSet.Fields_putField, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_putField);
apiImpl.putField(context, field); Kernel.getApiHooksService().post(context, CallName.Fields_putField);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.putField.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.putField.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public Boolean fieldExists(CallingContext context, String fieldUri) {
long functionStartTime = System.currentTimeMillis();
FieldExistsPayload requestObj = new FieldExistsPayload();
requestObj.setContext(context);
requestObj.setFieldUri(fieldUri);
ContextValidator.validateContext(context, EntitlementSet.Fields_fieldExists, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_fieldExists);
Boolean returnValue = apiImpl.fieldExists(context, fieldUri); Kernel.getApiHooksService().post(context, CallName.Fields_fieldExists);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.fieldExists.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.fieldExists.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public void deleteField(CallingContext context, String fieldUri) {
long functionStartTime = System.currentTimeMillis();
DeleteFieldPayload requestObj = new DeleteFieldPayload();
requestObj.setContext(context);
requestObj.setFieldUri(fieldUri);
ContextValidator.validateContext(context, EntitlementSet.Fields_deleteField, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_deleteField);
apiImpl.deleteField(context, fieldUri); Kernel.getApiHooksService().post(context, CallName.Fields_deleteField);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.deleteField.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.deleteField.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
}
/**
*
*/
@Override
public List getDocumentFields(CallingContext context, String docURI, List fields) {
long functionStartTime = System.currentTimeMillis();
GetDocumentFieldsPayload requestObj = new GetDocumentFieldsPayload();
requestObj.setContext(context);
requestObj.setDocURI(docURI);
requestObj.setFields(fields);
ContextValidator.validateContext(context, EntitlementSet.Fields_getDocumentFields, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_getDocumentFields);
List returnValue = apiImpl.getDocumentFields(context, docURI, fields); Kernel.getApiHooksService().post(context, CallName.Fields_getDocumentFields);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.getDocumentFields.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.getDocumentFields.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
/**
*
*/
@Override
public List putDocumentAndGetDocumentFields(CallingContext context, String docURI, String content, List fields) {
long functionStartTime = System.currentTimeMillis();
PutDocumentAndGetDocumentFieldsPayload requestObj = new PutDocumentAndGetDocumentFieldsPayload();
requestObj.setContext(context);
requestObj.setDocURI(docURI);
requestObj.setContent(content);
requestObj.setFields(fields);
ContextValidator.validateContext(context, EntitlementSet.Fields_putDocumentAndGetDocumentFields, requestObj);
long preToPostStartTime = System.currentTimeMillis();
Kernel.getApiHooksService().pre(context, CallName.Fields_putDocumentAndGetDocumentFields);
List returnValue = apiImpl.putDocumentAndGetDocumentFields(context, docURI, content, fields); Kernel.getApiHooksService().post(context, CallName.Fields_putDocumentAndGetDocumentFields);
long endFunctionTime = System.currentTimeMillis();
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.putDocumentAndGetDocumentFields.fullFunctionTime.succeeded", (endFunctionTime-functionStartTime));
Kernel.getMetricsService().recordTimeDifference("apiMetrics.fieldsApi.putDocumentAndGetDocumentFields.preToPostTime.succeeded", (endFunctionTime-preToPostStartTime));
return returnValue;}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy