code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
static void generateConfigFile(String configFilePath) throws ConfigurationException {
String fileExtention = FilenameUtils.getExtension(configFilePath);
ConfigProvider<Configuration> provider = getProviderByFileExtention(fileExtention);
if (!AuditUtil.isFileExists(configFilePath)) {
... | java |
private static ConfigProvider<Configuration> getProviderByFileExtention(String extention) throws ConfigurationException {
ConfigProvider<Configuration> provider;
if (XML_EXTENTION.equals(extention)) {
provider = new XMLConfigProvider<>(Configuration.class);
} else if (YML_EXTENTION.e... | java |
static Path getEnvironemtVariableConfigFilePath() {
final String value = System.getenv(ENVIRONMENT_CONFIG_VARIABLE_NAME);
return Paths.get(value);
} | java |
static boolean hasEnvironmentVariable(String variable) {
final String value = System.getenv(variable);
if (value != null) {
return true;
}
return false;
} | java |
static Path getSystemPropertyConfigFilePath() {
final String path = System.getProperty(SYSTEM_PROPERTY_CONFIG_VARIABLE_NAME);
return Paths.get(path);
} | java |
static boolean hasSystemPropertyVariable(String variable) {
final String path = System.getProperty(variable);
if (path != null) {
return true;
}
return false;
} | java |
static InputStream getFileAsStream(File resourceFile) throws ConfigurationException {
try {
return new FileInputStream(resourceFile);
} catch (FileNotFoundException e) {
Log.error("File Resource could not be resolved. Given Resource:" + resourceFile, e);
throw new Con... | java |
static boolean hasDiskAccess(final String path) {
try {
AccessController.checkPermission(new FilePermission(path, "read,write"));
return true;
} catch (AccessControlException e) {
return false;
}
} | java |
public static ClassLoader getClassLoader(final Class<?> clazz) {
// Context class loader can be null
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null) {
return contextClassLoader;
}
if (clazz != null... | java |
public List<E> getBuffered() {
List<E> temp = new ArrayList<>(buff);
clear();
return temp;
} | java |
public void setRepository(String repository) {
if (meta == null) {
meta = new EventMeta();
}
meta.setRepository(repository);
} | java |
public void setClient(String client) {
if (meta == null) {
meta = new EventMeta();
}
meta.setClient(client);
} | java |
public static String encodeLines(final byte[] input, final int iOff, final int iLen, final int lineLen,
final String lineSeparator) {
final int blockLen = (lineLen * CONSTANT_3) / CONSTANT_4;
if (blockLen <= 0) {
throw new IllegalArgumentException();
}
final int lines =... | java |
public static byte[] decodeLines(final String text) {
char[] buf = new char[text.length()];
int pValue = 0;
for (int ip = 0; ip < text.length(); ip++) {
final char cValue = text.charAt(ip);
if (cValue != ' ' && cValue != '\r' && cValue != '\n' && cValue != '\t') {
... | java |
public final static String toJson(Object object, DeIdentify deidentify) {
if (isPrimitive(object)) {
Object deidentifiedObj = deidentifyObject(object, deidentify);
String primitiveValue = String.valueOf(deidentifiedObj);
if (object instanceof String || object instanceof Chara... | java |
public static String deidentifyLeft(String str, int size) {
int repeat;
if (size > str.length()) {
repeat = str.length();
} else {
repeat = size;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), 0, size);
} | java |
public static String deidentifyRight(String str, int size) {
int end = str.length();
int repeat;
if (size > str.length()) {
repeat = str.length();
} else {
repeat = size;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), end - size, end);
} | java |
public static String deidentifyMiddle(String str, int start, int end) {
int repeat;
if (end - start > str.length()) {
repeat = str.length();
} else {
repeat = (str.length()- end) - start;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), start, str.length()-end);
} | java |
public static String deidentifyEdge(String str, int start, int end) {
return deidentifyLeft(deidentifyRight(str, end), start);
} | java |
final static void stop() {
if (lifeCycle.getStatus().equals(RunStatus.RUNNING) || lifeCycle.getStatus().equals(RunStatus.DISABLED)) {
lifeCycle.setStatus(RunStatus.STOPPED);
Log.info("Preparing to shutdown Audit4j...");
Log.info("Closing Streams...");
auditStream.close();
Log.info("Shutdown handlers.... | java |
final static void enable() {
if (lifeCycle.getStatus().equals(RunStatus.READY) || lifeCycle.getStatus().equals(RunStatus.STOPPED)) {
init();
} else if (lifeCycle.getStatus().equals(RunStatus.DISABLED)) {
lifeCycle.setStatus(RunStatus.RUNNING);
}
} | java |
private final static void checkEnvironment() {
// Check java support.!
boolean javaSupport = EnvUtil.isJDK7OrHigher();
if (!javaSupport) {
Log.error("Your Java version (", EnvUtil.getJavaersion(), ") is not supported for Audit4j. ",
ErrorGuide.getGuide(ErrorGuide.JAVA_VERSION_ERROR));
throw new Initial... | java |
private final static void loadConfig() {
try {
conf = Configurations.loadConfig(configFilePath);
} catch (ConfigurationException e) {
terminate();
throw new InitializationException(INIT_FAILED, e);
}
} | java |
private static void loadRegistry() {
// Load audit filters to runtime configurations.
for (AuditEventFilter filter : PreConfigurationContext.getPrefilters()) {
configContext.addFilter(filter);
}
// Load audit annotation filters to runtime configurations.
for (AuditAnnotationFilter annotationFilter : PreCon... | java |
private static void initHandlers() {
Log.info("Initializing Handlers...");
for (Handler handler : conf.getHandlers()) {
try {
if (!configContext.getHandlers().contains(handler)) {
Map<String, String> handlerproperties = new HashMap<>();
handlerproperties.putAll(configContext.getProperties());
... | java |
private static void initStreams() {
Log.info("Initializing Streams...");
MetadataCommand command = (MetadataCommand) PreConfigurationContext.getCommandByName("-metadata");
BatchCommand batchCommand = (BatchCommand) PreConfigurationContext.getCommandByName("-batchSize");
AsyncAnnotationAuditOutputStream async... | java |
private static AnnotationTransformer<AuditEvent> getDefaultAnnotationTransformer() {
DefaultAnnotationTransformer defaultAnnotationTransformer = new DefaultAnnotationTransformer();
ObjectSerializerCommand serializerCommand = (ObjectSerializerCommand) PreConfigurationContext
.getCommandByName("-objectSerializer"... | java |
static void validateConfigurations(Configuration conf) throws ValidationException {
if (null == conf.getHandlers()) {
Log.error(
"Handler should not be null, One or more handler implementation shuld be configured in the configuration",
ErrorGuide.getGuide(Erro... | java |
static boolean isSerializable(Object object) {
final boolean retVal;
if (implementsInterface(object)) {
retVal = attemptToSerialize(object);
} else {
retVal = false;
}
return retVal;
} | java |
private static boolean implementsInterface(final Object o) {
final boolean retVal;
retVal = (o instanceof Serializable) || (o instanceof Externalizable);
return retVal;
} | java |
private static boolean attemptToSerialize(final Object o) {
final OutputStream sink;
ObjectOutputStream stream;
stream = null;
try {
sink = new ByteArrayOutputStream();
stream = new ObjectOutputStream(sink);
stream.writeObject(o);
// coul... | java |
protected List<String> getOptionsByCommand(String command){
String rawOption = commands.get(command);
String[] options = rawOption.split(CoreConstants.COMMA);
return Arrays.asList(options);
} | java |
public void scanClass(InputStream bits) throws IOException {
DataInputStream dstream = new DataInputStream(new BufferedInputStream(bits));
ClassFile cf = null;
try {
cf = new ClassFile(dstream);
classIndex.put(cf.getName(), new HashSet<String>());
if (scanClas... | java |
protected void scanMethods(ClassFile cf) {
List<ClassFile> methods = cf.getMethods();
if (methods == null)
return;
for (Object obj : methods) {
MethodInfo method = (MethodInfo) obj;
if (scanMethodAnnotations) {
AnnotationsAttribute visible = (A... | java |
public void outputAnnotationIndex(PrintWriter writer) {
for (String ann : annotationIndex.keySet()) {
writer.print(ann);
writer.print(": ");
Set<String> classes = annotationIndex.get(ann);
Iterator<String> it = classes.iterator();
while (it.hasNext()) ... | java |
boolean canSearchConfigFile(ServletContext servletContext) {
String searchConfigFile = servletContext.getInitParameter("searchConfigFile");
if (searchConfigFile == null || searchConfigFile.equals("")) {
return false;
} else if ("true".equals(searchConfigFile)) {
return tr... | java |
boolean hasHandlers(ServletContext servletContext) {
String handlers = servletContext.getInitParameter("handlers");
return !(handlers == null || handlers.equals(""));
} | java |
private void setNumberHits(BitSet bits, String value, int min, int max) {
String[] fields = StringUtils.delimitedListToStringArray(value, ",");
for (String field : fields) {
if (!field.contains("/")) {
// Not an incrementer so it must be a range (possibly empty)
... | java |
private int[] getRange(String field, int min, int max) {
int[] result = new int[2];
if (field.contains("*")) {
result[0] = min;
result[1] = max - 1;
return result;
}
if (!field.contains("-")) {
result[0] = result[1] = Integer.valueOf(field)... | java |
@Override
public void execute(Runnable task) {
try {
this.concurrentExecutor.execute(task);
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + this.concurrentExecutor + "] did not accept task: " + task,
ex);
}
... | java |
private void executeArchive() {
for (AbstractArchiveJob archiveJob : jobs) {
archiveJob.setArchiveDateDiff(extractArchiveDateCount(archiveEnv.getDatePattern()));
archiveJob.setPath(archiveEnv.getDirPath());
archiveJob.setCompressionExtention(archiveEnv.getCompression().getExt... | java |
public Integer extractArchiveDateCount(String datePattern) {
int dateCount = 0;
String[] splits = datePattern.split("d|M|y");
if (splits.length > 0) {
dateCount = dateCount + Integer.valueOf(splits[0]);
}
if (splits.length > 1) {
dateCount = dateCount + (I... | java |
private static boolean isJDK_N_OrHigher(int n) {
List<String> versionList = new ArrayList<String>();
// this code should work at least until JDK 10 (assuming n parameter is
// always 6 or more)
for (int i = 0; i < 5; i++) {
//Till JDK 1.8 versioning is 1.x after 10 its will J... | java |
static public boolean isJaninoAvailable() {
ClassLoader classLoader = EnvUtil.class.getClassLoader();
try {
Class<?> bindingClass = classLoader.loadClass("org.codehaus.janino.ScriptEvaluator");
return bindingClass != null;
} catch (ClassNotFoundException e) {
... | java |
public static boolean hasConfigFileExists(String dirPath) {
String filePath = dirPath + File.separator + Configurations.CONFIG_FILE_NAME + ".";
if (AuditUtil.isFileExists(filePath + Configurations.YML_EXTENTION)
|| AuditUtil.isFileExists(filePath + Configurations.YAML_EXTENTION)
... | java |
public static URL findClassBase(Class clazz)
{
String resource = clazz.getName().replace('.', '/') + ".class";
return findResourceBase(resource, clazz.getClassLoader());
} | java |
private Cipher getCipher(int mode) throws InvalidKeyException, InvalidAlgorithmParameterException,
UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException {
Cipher c = Cipher.getInstance(ALGORYITHM);
byte[] iv = CoreConstants.IV.getBytes(CoreConstants.ENCODE_UTF8);
... | java |
public static EncryptionUtil getInstance(String key, String salt) throws NoSuchAlgorithmException,
UnsupportedEncodingException, InvalidKeySpecException {
if (instance == null) {
synchronized (EncryptionUtil.class) {
if (instance == null) {
instance = ... | java |
public static String getGuide(String code){
StringBuilder builder = new StringBuilder();
builder.append(" see ").append(code).append(" for further details.");
return builder.toString();
} | java |
public List<Field> getAllFields(final Method method, final Object[] arg1) {
final Annotation[][] parameterAnnotations = method.getParameterAnnotations();
List<Field> actionItems = new ArrayList<Field>();
int i = 0;
String paramName = null;
String paramValue = null;
Class<?> paramType;
for (final Annotat... | java |
public static Object quoteIfString(Object obj) {
return obj instanceof String ? quote((String) obj) : obj;
} | java |
@Override
public AuditEvent transformToEvent(AnnotationAuditEvent annotationEvent) {
AuditEvent event = null;
if (annotationEvent.getClazz().isAnnotationPresent(Audit.class)
&& !annotationEvent.getMethod().isAnnotationPresent(IgnoreAudit.class)) {
event = new AuditEvent();
Audit audit = annotationEvent.... | java |
private List<Field> getFields(final Method method, final Object[] params) {
final Annotation[][] parameterAnnotations = method.getParameterAnnotations();
final List<Field> fields = new ArrayList<Field>();
int i = 0;
String paramName = null;
for (final Annotation[] annotations : parameterAnnotations) {
fi... | java |
private Runnable errorHandlingTask(Runnable task, boolean isRepeatingTask) {
return TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
} | java |
public static Map<String, String> transformMap(final Map<String, Object> paramMap) {
final Map<String, String> paramStrMap = new LinkedHashMap<String, String>();
for (final Map.Entry<String, Object> entry : paramMap.entrySet()) {
paramStrMap.put(entry.getKey(), entry.getValue().toString());
... | java |
public static String dateToString(final Date date, final String format) {
if (date == null) {
return null;
}
final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
return dateFormat.format(date);
} | java |
public static Date stringTodate(String dateString, String format) throws ParseException {
final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
return dateFormat.parse(dateString);
} | java |
public static String timeStampToString(final Timestamp timestamp, final String format) {
return dateToString(new Date(timestamp.getTime()), format);
} | java |
public static boolean isFileExists(String filePathString) {
File file = new File(filePathString);
if (file.exists() && !file.isDirectory())
return true;
return false;
} | java |
public Timestamp parseTimestamp(String strValue) throws IllegalArgumentException {
if (fmt != null) {
Optional<Timestamp> parsed = tryParseWithFormat(strValue);
if (parsed.isPresent()) {
return parsed.get();
}
}
// Otherwise try default timest... | java |
@Override
public Object deserialize(Writable blob) throws SerDeException {
Text t = (Text) blob;
JsonParser p;
List<Object> r = new ArrayList<Object>(Collections.nCopies(columnNames.size(), null));
try {
p = jsonFactory.createJsonParser(new ByteArrayInputStream((t.getBytes())));
if (p.nex... | java |
@Override
public Writable serialize(Object obj, ObjectInspector objInspector)
throws SerDeException {
StringBuilder sb = new StringBuilder();
try {
StructObjectInspector soi = (StructObjectInspector) objInspector;
List<? extends StructField> structFields = soi.getAllStructFieldRefs();
a... | java |
private void setupCompositeInspector()
{
ForgePropertyStyleConfig forgePropertyStyleConfig = new ForgePropertyStyleConfig();
forgePropertyStyleConfig.setProject(this.project);
ForgeInspectorConfig forgeInspectorConfig = new ForgeInspectorConfig();
forgeInspectorConfig.setProject(this.project)... | java |
@Override
public ValueAndDeclaredType traverse(final Object toTraverse, final String type, final boolean onlyToParent,
final String... names)
{
// Traverse through names (if any)
if ((names == null) || (names.length == 0))
{
// If no names, no parent
if (onlyToPar... | java |
private void inspectClassProperties(final String type,
Map<String, Property> properties)
{
JavaSource<?> clazz = sourceForName(this.project, type);
if (clazz instanceof MethodHolder<?>)
{
lookupGetters(properties, (MethodHolder<?>) clazz);
lookupSetters(properties, (... | java |
protected String isGetter(final Method<?, ?> method)
{
String methodName = method.getName();
String propertyName;
if (methodName.startsWith(ClassUtils.JAVABEAN_GET_PREFIX))
{
propertyName = methodName.substring(ClassUtils.JAVABEAN_GET_PREFIX.length());
}
else if (metho... | java |
protected String isSetter(final Method<?, ?> method)
{
String methodName = method.getName();
if (!methodName.startsWith(ClassUtils.JAVABEAN_SET_PREFIX))
{
return null;
}
String propertyName = methodName.substring(ClassUtils.JAVABEAN_SET_PREFIX.length());
return StringU... | java |
@Override
public void newOneToOneRelationship(Project project, final JavaResource resource, final String fieldName,
final String fieldType,
final String inverseFieldName,
final FetchType fetchType, final boolean required,
final Iterable<CascadeType> cascadeTypes) throw... | java |
@Override
public void newManyToOneRelationship(
final Project project,
final JavaResource resource,
final String fieldName,
final String fieldType,
final String inverseFieldName,
final FetchType fetchType,
final boolean required,
... | java |
@Override
public void newEmbeddedRelationship(
final Project project,
final JavaResource resource,
final String fieldName,
final String fieldType) throws FileNotFoundException
{
JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
JavaClassSou... | java |
private boolean areTypesSame(String from, String to)
{
String fromCompare = from.endsWith(".java") ? from.substring(0, from.length() - 5) : from;
String toCompare = to.endsWith(".java") ? to.substring(0, to.length() - 5) : to;
return fromCompare.equals(toCompare);
} | java |
public Collection<JavaClassSource> allResources()
{
Set<JavaClassSource> result = new HashSet<>();
for (DTOPair pair : dtos.values())
{
if (pair.rootDTO != null)
{
result.add(pair.rootDTO);
}
if (pair.nestedDTO != null)
{
result.a... | java |
public void addRootDTO(JavaClass<?> entity, JavaClassSource rootDTO)
{
DTOPair dtoPair = dtos.containsKey(entity) ? dtos.get(entity) : new DTOPair();
dtoPair.rootDTO = rootDTO;
dtos.put(entity, dtoPair);
} | java |
public void addNestedDTO(JavaClass<?> entity, JavaClassSource nestedDTO)
{
DTOPair dtoPair = dtos.containsKey(entity) ? dtos.get(entity) : new DTOPair();
dtoPair.nestedDTO = nestedDTO;
dtos.put(entity, dtoPair);
} | java |
public boolean containsDTOFor(JavaClass<?> entity, boolean root)
{
if (dtos.get(entity) == null)
{
return false;
}
return (root ? (dtos.get(entity).rootDTO != null) : (dtos.get(entity).nestedDTO != null));
} | java |
public JavaClassSource getDTOFor(JavaClass<?> entity, boolean root)
{
if (dtos.get(entity) == null)
{
return null;
}
return root ? (dtos.get(entity).rootDTO) : (dtos.get(entity).nestedDTO);
} | java |
@Override
public boolean promptRequiredMissingValues(ShellImpl shell) throws InterruptedException
{
Map<String, InputComponent<?, ?>> inputs = getController().getInputs();
if (hasMissingRequiredInputValues(inputs.values()))
{
UIOutput output = shell.getOutput();
if (!getContext... | java |
protected <T extends ProjectFacet> boolean filterValueChoicesFromStack(Project project, UISelectOne<T> select)
{
boolean result = true;
Optional<Stack> stackOptional = project.getStack();
// Filtering only supported facets
if (stackOptional.isPresent())
{
Stack stack = stackOpt... | java |
@SuppressWarnings("unchecked")
private <F extends FACETTYPE> F safeGetFacet(Class<F> type)
{
for (FACETTYPE facet : facets)
{
if (type.isInstance(facet))
{
return (F) facet;
}
}
return null;
} | java |
@SuppressWarnings("unchecked")
@Override
public Object convert(Object source)
{
Object value = source;
for (Converter<Object, Object> converter : converters)
{
if (converter != null)
{
value = converter.convert(value);
}
}
return value;
} | java |
private String buildFacesViewId(final String servletMapping, final String resourcePath)
{
for (String suffix : getFacesSuffixes())
{
if (resourcePath.endsWith(suffix))
{
StringBuffer result = new StringBuffer();
Map<Pattern, String> patterns = new HashMap<>();
... | java |
protected String encodePassword(String password)
{
StringBuilder result = new StringBuilder();
if (password != null)
{
for (int i = 0; i < password.length(); i++)
{
int c = password.charAt(i);
c ^= 0xdfaa;
result.append(Integer.toHexString(c));
... | java |
public void registerMapping(String prefix, String namespaceURI)
{
prefix2Ns.put(prefix, namespaceURI);
ns2Prefix.put(namespaceURI, prefix);
} | java |
public static CharSequence prettyPrint(DependencyNode root)
{
StringBuilder sb = new StringBuilder();
prettyPrint(root, new Predicate<DependencyNode>()
{
@Override
public boolean accept(DependencyNode node)
{
return true;
}
}, sb, 0);
retu... | java |
protected void initializeEnablementUI(UIBuilder builder) {
enabled.setEnabled(hasEnablement());
if (getSelectedProject(builder).hasFacet(CDIFacet_1_1.class))
{
priority.setEnabled(hasEnablement());
builder.add(priority);
}
else
{
priority.setEnabled(false);... | java |
public static String colorizeResource(FileResource<?> resource)
{
String name = resource.getName();
if (resource.isDirectory())
{
name = new TerminalString(name, new TerminalColor(Color.BLUE, Color.DEFAULT)).toString();
}
else if (resource.isExecutable())
{
name ... | java |
@Override
protected void addColumnComponents(HtmlDataTable dataTable, Map<String, String> attributes, NodeList elements,
StaticXmlMetawidget metawidget)
{
super.addColumnComponents(dataTable, attributes, elements, metawidget);
if (dataTable.getChildren().isEmpty())
{
return... | java |
protected Resource<?> generateNavigation(final String targetDir)
throws IOException
{
WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);
HtmlTag unorderedList = new HtmlTag("ul");
ResourceFilter filter = new ResourceFilter()
{
@Override
publ... | java |
protected Map<String, String> parseNamespaces(final String template)
{
Map<String, String> namespaces = CollectionUtils.newHashMap();
Document document = XmlUtils.documentFromString(template);
Element element = document.getDocumentElement();
NamedNodeMap attributes = element.getAttributes();
... | java |
protected int parseIndent(final String template, final String indentOf)
{
int indent = 0;
int indexOf = template.indexOf(indentOf);
while ((indexOf >= 0) && (template.charAt(indexOf) != '\n'))
{
if (template.charAt(indexOf) == '\t')
{
indent++;
}
... | java |
protected void writeEntityMetawidget(final Map<Object, Object> context, final int entityMetawidgetIndent,
final Map<String, String> existingNamespaces)
{
StringWriter stringWriter = new StringWriter();
this.entityMetawidget.write(stringWriter, entityMetawidgetIndent);
context.put("metaw... | java |
protected void writeSearchAndBeanMetawidget(final Map<Object, Object> context, final int searchMetawidgetIndent,
final int beanMetawidgetIndent,
final Map<String, String> existingNamespaces)
{
StringWriter stringWriter = new StringWriter();
this.searchMetawidget.write(stringWriter... | java |
private boolean areTypesAssignable(Class<?> source, Class<?> target)
{
if (target.isAssignableFrom(source))
{
return true;
}
else if (!source.isPrimitive() && !target.isPrimitive())
{
return false;
}
else if (source.isPrimitive())
{
// source... | java |
@SuppressWarnings("unchecked")
protected Element findAndReplaceProperties(Counter counter, Element parent, String name, Map props)
{
boolean shouldExist = (props != null) && !props.isEmpty();
Element element = updateElement(counter, parent, name, shouldExist);
if (shouldExist)
{
I... | java |
protected Element findAndReplaceSimpleElement(Counter counter, Element parent, String name, String text,
String defaultValue)
{
if ((defaultValue != null) && (text != null) && defaultValue.equals(text))
{
Element element = parent.getChild(name, parent.getNamespace());
// if ... | java |
protected Element findAndReplaceSimpleLists(Counter counter, Element parent, java.util.Collection list,
String parentName, String childName)
{
boolean shouldExist = (list != null) && (list.size() > 0);
Element element = updateElement(counter, parent, parentName, shouldExist);
if (should... | java |
protected Element findAndReplaceXpp3DOM(Counter counter, Element parent, String name, Xpp3Dom dom)
{
boolean shouldExist = (dom != null) && ((dom.getChildCount() > 0) || (dom.getValue() != null));
Element element = updateElement(counter, parent, name, shouldExist);
if (shouldExist)
{
... | java |
protected void insertAtPreferredLocation(Element parent, Element child, Counter counter)
{
int contentIndex = 0;
int elementCounter = 0;
Iterator it = parent.getContent().iterator();
Text lastText = null;
int offset = 0;
while (it.hasNext() && (elementCounter <= counter.getCurrent... | java |
protected void iterateContributor(Counter counter, Element parent, java.util.Collection list,
java.lang.String parentTag, java.lang.String childTag)
{
boolean shouldExist = (list != null) && (list.size() > 0);
Element element = updateElement(counter, parent, parentTag, shouldExist);
if ... | java |
@SuppressWarnings("unchecked")
protected void replaceXpp3DOM(final Element parent, final Xpp3Dom parentDom, final Counter counter)
{
if (parentDom.getChildCount() > 0)
{
Xpp3Dom[] childs = parentDom.getChildren();
Collection<Xpp3Dom> domChilds = new ArrayList<>();
for (int i... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.